Setting up a new dev Mac - mhulse/mhulse.github.io GitHub Wiki

xCode

Make sure xCode is installed; if not, install it.

Once installed, open xCode's prefs and install anything seen here:

xcode-prefs

It can't hurt to check the "Check for and install updates automatically" checkbox. :+1:

Install the developer command line tools:

$ xcode-select --install

… and follow the on-screen instructions.

Java

$ java --request

… and click “More info…” to visit the Java Developer Kit download website.

On the Oracle site, select the “Accept License Agreement” option and download the latest MacOS installer (e.g., jdk-8u102-macosx-x64.dmg). Run the installer.

Dot files …

Now's a good time to setup your command line bits. Here's mine. Installing now …

IDE

I currently prefer ST3. Installing now!

Here's my personal ST3 installation and setup instructions.

Homebrew

Install Homebrew like so:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Most up-to-date instructions can be found on the Homebrew landing page.

Once installed, immediately run:

$ brew update
$ brew upgrade
$ brew doctor

Fix any issue that may arise. Follow the on-screen instructions.

Restart and agreements

At this point, now that xCode and Homebrew are installed, restart your machines and open xCode; agree to anything it asks.

Run $ brew doctor again.

Bash completion

$ brew install bash-completion

Upgrade Bash

See: Upgrade bash on OS X

Brew install Node (and npm)

Get Node:

$ brew install node

That will install Node.js which comes with npm.

Upgrade Node using Brew:

$ brew upgrade node
# Everything:
$ brew upgrade

When you install, or upgrade, Node/npm, you might see:

If you update npm itself, do NOT use the npm update command.
The upstream-recommended way to update npm is:
  npm install -g npm@latest

You’d be wise to follow those instructions. :+1:

Note: There’s lots of good Brew-usage tips here.

Install Ruby and RVM

At the command line prompt:

$ \curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles --autolibs=enable --ruby

That will install a fresh copy of Ruby and turn on autolibs without modifying your user’s dot files.

Once installed, run:

$ source /Users/mhulse/.rvm/scripts/rvm

Add this to your .bash_profile:

# Load RVM into a shell session *as a function*:
[ -s "$HOME/.rvm/scripts/rvm" ](/mhulse/mhulse.github.io/wiki/--s-"$HOME/.rvm/scripts/rvm"-) && source "$HOME/.rvm/scripts/rvm"

Reload your current terminal session:

$ source ~/.bash_profile

From here on out, use these commands to keep things current:

# Update rvm:
$ rvm get stable
# Update rvm Ruby:
$ rvm install current && rvm use current
# Update rvm gems:
$ gem update

I’d restart your machine at this point.

See also: Ruby tips

Bundler!

Like pyvenv for Python, Bundler provides a consistent environment for Ruby projects, so … let’s install it:

$ gem install bundler

I have example Bundler usage instructions here.

Python 3.4.x!

At the command line prompt:

$ brew install python3

Add these aliases to your profile (e.g., .bash_profile):

# Default Python
alias python=python3.4
# Default pyvenv
alias pyvenv=pyvenv-3.4
# Default pip
alias pip=pip3.4

The above aliases make it easier to run the latest Python (and pip) on your system.

# Pip, setuptools, and wheel have been installed. To update them:
$ pip3 install --upgrade pip setuptools wheel

Reload:

$ source ~/.bash_profile

Now you can create a pyvenv and use pip to install packages within your environment.

See also: Django local dev

Git

$ brew install git

SSH key(s)

If using GitHub or BitBucket, you will want to setup SSH keys for both:

XAMPP

Setup XAMPP: Mac.