Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esilvas/3202862 to your computer and use it in GitHub Desktop.
Save esilvas/3202862 to your computer and use it in GitHub Desktop.
Fix Homebrew after Mountain Lion Upgrade

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

3) Let Everyone Know Where XCode Is

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

4) Install X11

Visit http://xquartz.macosforge.org/trac/wiki and download and install 2.7.2+.

You will need to fix the symlink it makes:

ln -s /opt/X11 /usr/X11

5) Reinstall your brews

brew list

Will tell you what you need to check. Try out everything one by one and when one doesn't work brew remove it and then reinstall it. If the install doesn't work, try brew install it --use-gcc to prevent llvm from getting in the way.

Things that gave me issues that I had to remove and install:

  • MySQL

Gratefully copied from https://gist.github.com/1860902

Apache Setup

Apache is installed in Mountain Lion. However, as in previous OS X versions, it can not be managed from the Sharing System Preference. You will need to start it up from the command line. You can do it with the following:

apachectl start

To stop Apache

apachectl stop

and restart Apache

apachectl restart

After starting, go to your default local website by visiting http://localhost/. The default file root is:

/Library/WebServer/Documents/

If you would also like to have your user level Sites appear, first look for your conf file (username.conf) here:

/etc/apache2/users/

If it does not exist, you need to create one. Go to the folder:

cd /etc/apache2/users

Then create your conf file:

sudo nano username.conf

Once inside the text editor, add your user folder with the following content. Note: make sure to change 'username' with your own.

<Directory "/Users/username/Sites/">
 Options Indexes MultiViews
 AllowOverride All
 Order allow,deny
 Allow from all
</Directory>

Restart Apache

sudo apachectl restart

Go to your user site:

http://localhost/~username/

Wonderful content from http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion.

PHP Setup

PHP 5.3.13 is also installed on Mountain Lion. You must turn it on by uncommenting part of the httpd.conf file:

sudo nano /etc/apache2/httpd.conf

Search for the following line (using Control+w):

LoadModule php5_module libexec/apache2/libphp5.so

Save (control+x) and restart Apache.

sudo apachectl restart

MySQL

As mentioned above, I have had problems with MySQL. I had it installed under Homebrew. But, after the Mountain Lion update, I have not been able to reconnect. So, I had to bite the bullet and download the official version from MySQL.org. You can find it here http://dev.mysql.com/downloads/mysql/. Install all three (3) components, MySQL PrefsPane and Automatic start.

This where I had the biggest problem. After installing, you should be able to set the root password with this command:

/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'

In my case, I kept getting an error:

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Eventually (and with help from http://www.debian-administration.org/articles/442) I got it working. First, you have to stop MySQL. Once that is done, you need to restart it while skipping the grant tables. This will allow you to connect without MySQL limiting access.

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &

Once it restarts, login as root and select the mysql db with the following:

mysql --user=root mysql

Now, set the new password:

mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';
Query OK, 2 rows affected (0.04 sec)
Rows matched: 2  Changed: 2  Warnings: 0

Flush privileges:

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

Exit MySQL:

mysql> exit
Bye

After stopping and restarting MySQL, you should be able to connect with the following:

mysql --user=root --pass=new-password-here
@millisami
Copy link

The step 4 of manually linking is not required for me.
Installed X11 ver X112.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment