Sometimes you want to install software that is typically categorized as F/OSS (Free, or Open Source Software).
Homebrew is a packaging system for OS X which makes installing (and keeping them updated) many of these bits of software easy.
Install Xcode
To start with, we need to install the Xcode tools. Its not necessary to install all of Xcode to do this. We can simply run:
1xcode-select --install
Install homebrew
Now that we have Xcode tools installed, we can install homebrew. Start by looking at the web page: http://brew.sh
When you’re ready, open up Terminal.app and paste in the following (this assumes you are using a bourne shell derivitive. If not, you will need to modifiy as appropriate):
1ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Homebrew installs a bunch of files into ‘/usr/local’ and its intended to be run as a regular user (with the implication that ‘/usr/local’ needs to be owned and writable by said regular user.
Brew update
The first thing you should know how to do is update the brew repository.
1brew update
This will reach out to github and pull down the current version of the homebrew repository, containing all the recipies for packages you may want to use.
Brew install example
Now that you have homebrew installed, you can use it to install software. For example, I like to install the ‘mtr’ package instead of using the traditional traceroute. The install process looks like this:
1[louisk@iPwn louisk ]$ brew install mtr
2==> Downloading ftp://ftp.bitwizard.nl/mtr/mtr-0.86.tar.gz
3Already downloaded: /Library/Caches/Homebrew/mtr-0.86.tar.gz
4==> ./configure --prefix=/usr/local/Cellar/mtr/0.86 --without-gtk
5--without-glib
6==> make install
7==> Caveats
8mtr requires root privileges so you will need to run `sudo mtr`.
9You should be certain that you trust any software you grant root privileges.
10
11==> Summary
12🍺 /usr/local/Cellar/mtr/0.86: 8 files, 148K, built in 13 seconds
13[louisk@iPwn louisk ]$
The output from running ‘sudo mtr -c 1 google.com’ might look like:
1 My traceroute [v0.86]
2iPwn (0.0.0.0) Wed Jul 8 18:07:53 2015
3Keys: Help Display mode Restart statistics Order of fields quit
4 Packets Pings
5 Host Loss% Snt Last Avg Best Wrst StDev
6 1. pfsense.work 0.0% 1 1.7 1.7 1.7 1.7 0.0
7 2. bc1041.bendcable.com 0.0% 1 10.9 10.9 10.9 10.9 0.0
8 3. 60.157.100.208.bendbroadband.com 0.0% 1 10.2 10.2 10.2 10.2 0.0
9 4. 70.157.100.208.bendbroadband.com 0.0% 1 11.0 11.0 11.0 11.0 0.0
10 5. 208.100.157.0 0.0% 1 18.9 18.9 18.9 18.9 0.0
11 6. google.nwax.net 0.0% 1 20.0 20.0 20.0 20.0 0.0
12 7. 66.249.94.214 0.0% 1 22.4 22.4 22.4 22.4 0.0
13 8. 66.249.94.201 0.0% 1 104.3 104.3 104.3 104.3 0.0
14 9. 209.85.241.42 0.0% 1 62.9 62.9 62.9 62.9 0.0
1510. 216.239.50.249 0.0% 1 77.7 77.7 77.7 77.7 0.0
1611. 74.125.37.37 0.0% 1 149.3 149.3 149.3 149.3 0.0
1712. 72.14.235.14 0.0% 1 156.6 156.6 156.6 156.6 0.0
1813. 72.14.234.232 0.0% 1 162.1 162.1 162.1 162.1 0.0
1914. 66.249.94.53 0.0% 1 160.5 160.5 160.5 160.5 0.0
2015. 66.249.95.137 0.0% 1 162.6 162.6 162.6 162.6 0.0
2116. zrh04s05-in-f5.1e100.net 0.0% 1 168.7 168.7 168.7 168.7 0.0
If you don’t want to have to call mtr with sudo, you can do the following:
1chmod 4755 /usr/local/Cellar/mtr/0.86/sbin/mtr
2sudo chown root /usr/local/Cellar/mtr/0.86/sbin/mtr
You will probably have to substitute a newer version for the ‘0.86’. After you run these commands, you should be able to execute mtr with out using sudo.
Brew search
Now, you can go use brew to install other software. Search the list of available packages with
1brew search
If you don’t specify a name or an expression ‘/expression/’, it will dump all that is available.
Once you’ve selected the package you wish to install, you can
1brew install <package_name>
Brew upgrade (all)
Lastly, you should know how to upgrade packages you’ve installed. Presuming you’ve already run a ‘brew update’ (discussed above), you should run
1brew upgrade --all
This will look through all of the packages you have installed, compare it to the current list (this information was fetched when you ran ‘brew update’), and then it will upgrade any packages that are out of date.
Comments