Last active
October 6, 2017 02:47
Setting up a new Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pro tips in the comments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setting up a new Mac
Quick start
Homebrew is essential. Other than Google Chrome, it's probably the first app a developer should install on a new Mac.
You can read about Homebrew at https://brew.sh or install it with one line:
On a Mac, the pre-installed command line tools (such as git, vim, curl, tar, gzip, openssl, php, nslookup, etc) are found in
/usr/bin/
. Homebrew installs additional packages (and their dependencies) in/usr/local/bin/
where they are sandboxed away from the operating system.In general, your Mac includes recent, stable versions of *NIX tools that "just work," so you can use them out of the box.
Try it:
One popular command line tool, wget, is not included on new Macs. Homebrew makes it easy to add wget and countless other *NIX and Gnu tools to your system. To install wget, for example, run
brew install wget
.If the version of git included with MacOS is not fancy enough for you,
brew install git
will fetch a newer version. If you change your mind, justbrew remove git
to remove the Homebrew-managed package (the core operating system software will not be altered, so the Apple version of git that came with your computer will "just work" again if you uninstall Homebrew.) Developers love Homebrew, because it keeps their system clean and avoids cumbersome $PATH editing when you want to add functionality.Suppose you need to encrypt or decrypt files with GPG, you could run
brew install gpg
. The versions of sed, awk, zcat etc that ship with the Mac workly slightly differently than what you would find on Ubuntu. If this ever becomes a problem for you, Homebrew can bridge the gap, because you can install the exact Linux versions of Gnu tools by runningbrew install coreutils gnu-sed
. Whatever you need, Homebrew and Google should have you covered.brew list
shows you what packages you have installed. If you want to uninstall every package you've ever installed with Homebrew, you can do that.Now that you know what Homebrew is and what it does, install Drupal tools. You will definitely want Drush and Composer available globally on your system. Run these commands in sequence:
Then run:
Next, install Composer:
Finally, install Drush:
You can install binaries, too
Most likely, you'll want your familiar Google Chrome browser (perhaps Firefox too) and Vagrant, and VirtualBox. You'll also need a good text editor like Sublime Text or BBEdit. Other editors are listed on D.O.. You can get apps the old-fashioned way (by downloading them from websites) or you can install the latest versions with Homebrew with these commands:
Maybe that was unnecessary, but it's nifty and fast!
Get your Acquia aliases
Drush aliases make it easy to SSH into your Acquia servers, for example
drush @server.env ssh
.First generate an SSH key that you can use with Acquia, GitHub, and other services:
Log on to Acquia Cloud and navigate to your user profile. Edit your profile, then go to your Credentials page to add your public key.
In addition to adding your SSH key to your Acquia profile, you can download Drush aliases that reflect your organization's Teams and permissions. Once you've downloaded your custom file, install your Acquia aliases with this:
To see what sites you can access, run
drush site-alias
(or simplydrush sa
). If your organization administrator has changed your access rights, rundrush acquia-update
to refresh your drush aliases.Create a folder for your codebases
I like to create a folder where I'll keep sites and codebases:
If you want to install Drupal VM, you can do that now, with Vagrant. (Please note that while the install process is automated, it takes a long time... 20-25 mins or so depending on your network connection speed.)
When this process is complete, you'll have the latest version of Drush running locally, in an Ubuntu VM, on your Mac. If you haven't used Drupal VM before, this is a great introduction to Drupal VM.
The Drupal VM maintainer recommends Ansible, so install that first:
Navigate to the directory where you'll keep this demo VM:
When this is all complete you'll have a Drupal VM dashboard, open Chrome and go to http://dashboard.drupalvm.test
Read more on the Drupal VM site.
Command line protips
open .
will open new Finder window showing the contents of the current directory.bbedit settings.php
from a Terminal prompt.Mac developer setup guides are dime-a-dozen on the web, but you've just read the best one. Here's another useful resource that I found. Google has more.
Finder protips
TK