Josh Thompson     about     archive     turing     office hours

Turing Prep appendix: Troubleshooting Errors

Index of this series:

As you run into problems (and others) let me know. I’d like to collect a broad swath of the errors folks run into, and the solutions, so they don’t get too caught up.

Here’s a quick index of what’s in this guide:

Traceback... cannot load such file -- pry

This seems like an intimidating error message at first.

It’s not. The error just says:

Dear user, you’ve asked me to import code to run these tests, but I cannot find the code you require.

The code I was looking for (and cannot find) is called pry

Pry is an amazing tool. You’ll soon come to love it. In the mean time, just install it. It’s a ruby “gem” so you use the gem install <gem_name> command.

In your terminal, run gem install pry and then run the tests again.

Cannot open atom from the terminal

You may need to install the Atom Shell Commands. Atom makes it super easy to do this:

install shell commands

FSPathMakeRef and a bunch of other stuff

Here’s an error one student saw:

FSPathMakeRef(/Applications/ failed with error -36.

Googling around led here:

One possible cause was the user’s machine had two instances of on it. (In this case, one was in the Downloads folder, the other in Applications. Delete one of them, try again.

gem install pry failing with “you do not have permission”

If you get an error like this:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

Don’t worry. We’ll sort you out. It’ll take some work.

First, lets see which installed version of Ruby your computer is trying to use when you type ruby:

$ which ruby

If you get something that looks like this:


We’ll need to fix it. Read on.

If you get something like one of these:


You’re in good shape. Stop reading this section. The rest of this fix will not apply to you.


This means you’re using the version of Ruby that came installed on your laptop. You shouldn’t be messing with this version of Ruby, so your system isn’t letting you.

To use Ruby safely, you’ll need to install some tool to manage Ruby’s environment. rbenv is the most common tool for this:

You should have [homebrew]( on your computer already. If you don’t figure out how to install it.

If you have it, here’s a summary of the instructions for MacOS:

$ brew install rbenv
$ rbenv init

Restart your terminal.

Now, make sure (again) that rbenv is working:

$ rbenv -v

You should get something like rbenv 1.1.2 back.

Next, tell rbenv to install ruby 2.4.1:

$ rbenv install 2.4.1

And then set this version of ruby as the “global” version to use, until you tell it otherwise or a particular project specifies a different version:

$ rbenv global 2.4.1

You can now do gem install pry, and it will install the gem to the 2.4.1 version of Ruby, as managed by rbenv.

Get occasional emails

If I've written anything new, you'll get an email with summaries on Friday.