Installing MySQL on a MacBook

For some reason my old MacBook didn’t have MySQL installed.

Here’s the install process:

1. Brew did not work ‘cos it wasn’t installed

brew install mysql
-bash: brew: command not found

http://madebyhoundstooth.com/blog/install-mysql-on-mountain-lion-with-homebrew/

2. So, I went to install brew

ruby -e “$(curl -fsSkL raw.github.com/mxcl/homebrew/go)”
curl: (1) Protocol https not supported or disabled in libcurl

http://www.bigfastblog.com/homebrew-intro-to-the-mac-os-x-package-installer

3. So, I went to install curl with SSL

sudo port install curl +ssl

http://www.bigfastblog.com/homebrew-intro-to-the-mac-os-x-package-installer

—>  Computing dependencies for curl
—>  Verifying checksum(s) for curl-ca-bundle
Error: Checksum (md5) mismatch for certdata-1.57.txt
Error: Checksum (sha1) mismatch for certdata-1.57.txt
Error: Checksum (rmd160) mismatch for certdata-1.57.txt
Error: Target org.macports.checksum returned: Unable to verify file checksums
Error: The following dependencies failed to build: curl-ca-bundle
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.

4. So I updated port with

sudo port selfupdate

https://trac.macports.org/ticket/25929

This was successful but recommended this:

The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated

5. So, back to:

sudo port install curl +ssl

This got as far as:
--->  Activating ncurses @5.9_2
Error: org.macports.activate for port ncurses returned: Image error: /opt/local/bin/captoinfo is being used by the active ncursesw port.  Please deactivate this port first, or use 'port -f activate ncurses' to force the activation.
Error: Failed to install ncurses

and failed. But with a suggestion. So:

port -f activate ncurses
Error: Insufficient privileges to write to MacPorts install prefix.

sudo port -f activate ncurses
Password:
--->  The following versions of ncurses are currently installed:
--->      ncurses @5.7_0
--->      ncurses @5.9_2
Error: port activate failed: Registry error: Please specify the full version as recorded in the port registry.

A bit of a guess but this seemed to work:
sudo port -f activate ncurses @5.9_2

6. So back to:
sudo port install curl +ssl

After many hours this completed. In the meantime it had installed perl, python, git and sqlite - amongst others!

7. Back to installing brew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

which was successful.

8. And finally, installing mysql

`brew install mysql`
which had a few warnings:
Warning: Your Xcode (3.2.2) is outdated
Please install Xcode 3.2.6.
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.

and, perhaps unsurprisingly, was unsuccessful with these messages:
[ 94%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestGIT.cxx.o
[ 94%] Building CXX object Source/CMakeFiles/CTestLib.dir/CTest/cmCTestHG.cxx.o
Linking CXX static library libCTestLib.a
[ 94%] Built target CTestLib
make: *** [all] Error 2
Error: Homebrew doesn't know what compiler versions ship with your version
of Xcode (3.2.2). Please `brew update` and if that doesn't help, file

Running `brew update` just gave:
Already up-to-date.

So, updating Xcode. The App Store version isn't supported on Snow Leopard so you need to sign in to Apple's Developer Tools with your Apple ID and get it from:

https://developer.apple.com/downloads/index.action

and find `Xcode 3.2.6 and iOS SDK 4.3 for Snow Leopard` which is a 4.14GB download. Don't do this over your 3G network!

Install.

Finally:
`brew install mysql`
is successful. Phew! And just shows how cool and labour-saving brew can be - just take a look at the steps involved to install curl with ssl.

One final note:
9. It's worth taking these steps to configure MySQL:

http://madebyhoundstooth.com/blog/install-mysql-on-mountain-lion-with-homebrew/

Any lessons to be learned?
Possibly that it takes an awful lot of updates to update the software on an old computer.









 

Reclaiming disk space on the Mac

When I bought my MacBook Pro I immediately ditched the hard drive that came with it, open up the system and installed an SSD drive – immediately voiding the warranty!

But, I got some amazing response times – applications launch almost immediately – heaven!

The downside, however, is that your disk space is at a premium. So, I’ve got a bunch of ways to reclaim disk space. I’m an iOS and web developer so they’re more geared to that type of usage. Here are my top tips sorted by priority:

High

If the Mac is complaining about low disk space and I need an immediate fix here’s what I do:

1. Empty Trash

2. Run ./bin/reclaimMacDiskSpace.sh

This is a series of scripts that delete non-important stuff such as iPhoneSimulator apps, DerivedData, Downloads (I can always re-download stuff!) and Mobile Backups.

I won’t list the script details ‘cos it should all be pretty obvious. But ping me if you’re interested.

These turn out to save a surprising amount of space right off the bat. 

Medium

When I have a bit more time (usually after something important has happened like I’ve run out of disk space or Xcode won’t install due to insufficient space!) I’ll do these:

Backup to an external drive then delete: 

1. iPhone app Archives: ~/Library/Developer/Xcode/Archives

2. Old versions under iOS DeviceSupport: ~/Library/Developer/Xcode/iOS DeviceSupport

http://stackoverflow.com/questions/5302789/can-i-remove-previous-versions-of-iphone-support-in-devicesupport-folder-in-xcod

3. Mobile backups under: ~/Library/Application Support/MobileSync/Backup.local

At one time I had over 2GB of data here!

Low

When I want to be really meticulous (and I sometimes make a point of clearing out an additional 20GB of space on my SSD drive) I go through these:

1. use OmniDiskSweeper to work out what’s using the most space and start off by clearing these out

2. Use Gemini.app to dedupe files

Any other suggestions?

USB port not working on MacBook Pro – reset the SMC

Half of my USB devices suddenly seemed to stop working.

At first I thought it was the USB hub. It was hard to work out how it should respond – should there be lights on or not?

Then I tracked it down to one of my USB ports on my MacBook Pro.

Fortunately, it turned out resetting the SMC (Systems Management Controller) did the job. This article has more information although it doesn’t explicitly mention USB ports.

http://support.apple.com/kb/ht3964

 

Automatic Post Tagger

Not quite as awesome as an automatic post categoriser but still pretty handy:

http://wordpress.org/extend/plugins/automatic-post-tagger/