Atom and Terminal

I wrote a guide about this about five years ago – Ruby Newbies – My Ruby on Rails Recipe – but in the meantime, life has changed.  We’re now on OSX High Sierra (about to introduce Mojave, so this will be obsolete in a couple of months), and because of that, everything is different.

Here’s what we are going to cover in this really simple guide.

  • OSX Command Line Tools
  • Installing HomeBrew
  • Installing Zshell
  • Fixing your terminal so you look like you know what you’re doing

Installing OSX Command Line Tools

Open the terminal application.  What’s Terminal you ask? Where is Terminal? Who is this Terminal fella you’re talking about?  Listen, if you don’t know what/who, and WHERE terminal is, go find a smart friend and have them walk you through everything on here…sure I could link you to Terminal, but if you don’t know how to use basic bash commands, you do not have a license to do anything here.

Type the following:

xcode-select -p

If you see:

/Applications/Xcode.app/Contents/Developer

Congratulations! Past you did something awesome, and the full Xcode package is already installed.

You still need to update to the latest version, so go to the App Store application and check “Updates.” After updating Xcode, be sure to launch the Xcode application and accept the Apple license terms.

However, I know you, and you didn’t see that did you?  Noooo, what you saw was a sad message like this.

xcode-select: error: unable to get active developer directory, use `sudo xcode-select --switch path/to/Xcode.app` to set one (or see `man xcode-select`)

Bad news friendo, you don’t have X-Code.  That’s okay though, we’re going to solve that with one little command.

xcode-select --install

BOOM! Life changed. Follow the prompts. If you can’t follow the prompts, go find that smart friend, this is the easy stuff.

Congratulations little buddy! YOU HAVE XCODE!

Installing Home Brew

Okay, here’s where things get a little dicey, you’re now going to live in the land of the command line.

I’m sorry about your luck, but this is the way things are now.

Home Brew is cool. It does a bunch of awesome stuff, the most impressive of which is to let you install things your Mac doesn’t have from the command line (“But, but, but Brian…” you say…”I don’t understand the command line!!! Why would I want to install things from it?” Please, I beseech thee…go find that smart friend. You owe them a beer. Hand them your computer, and a nice craft ale and say “Please?”).

You should learn about HomeBrew and what it does. Basically it’s the installer that Apple forgot to add.

How do I install Homebrew?
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

BANG! Done!

How to install ZShell

Wait, what the heck is ZShell and why do I care? Zshell basically makes your terminal 10x more powerful, and it’s incredibly easy to use.

To install, we’re going to use curl in our terminal (cool kids might use wget, but let’s be honest, you and I are not there yet).  You simply do this.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Yeah, now you are living in ZShell land. It’s not super cool yet though, we are going to do two things to fix it.

Let’s make your theme pretty.

Go to this URL IR-Black on OSX and click the button labelled “Clone or Download”, then select zip.

Unzip the file, and open your Terminal.

Click the menu item Terminal > Preferences

Click on Profiles.

Click the gear icon and click “Import”. Navigate to the unzipped IR_Black.terminal file and import it.

Click the on IR_Black, and then click the “Default” button.  This is now your default skin for terminal.

Black is the new Black.

Install Atom – the best editor on the planet

Go here and install Atom.

Now we’re going to create a symbolic link in the command line to Atom so that you can open folders in Atom.

In Terminal, type this:

ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom

Isn’t life grand?

Now that we’ve done that, we’re going to do some magic with our zsh configuration file that will make things better.

In Terminal, we’re going to type this:

atom .zshrc

What we’re doing is using our newly installed symlink to Atom to open up the configuration file.

On line 10, you’ll see something that looks like this.

ZSH_THEME="robbyrussell"

Robby Russell is a nice dude, but Mr Tazz is cooler, so we’re going to change that.

ZSH_THEME="mrtazz"

This is a much cleaner theme.

You now have your basic system set up. Up next? Adding Rails and getting it all running.

Comments

comments