Skip to content
Malouf Developer Docs

Shopify Cli

Local Development

Disclaimer: Unless you’re creating a theme from scratch, you probably could get away with not having it set up locally. But if you want to do some editing on your local machine or pull down the repository, I suggest setting up the Shopify Cli for easier development and to run checks on your theme periodically.

Let’s open teriminal and navigate to your home directory. I suggest using Homebrew if you aren’t already. It’s a useful tool. Also, the following set up is specific to macOS. If you are running on a different operating system, please refer to the official Shopify guide.

To get started run:

$ brew tap shopify/shopify
$ brew install shopify-cli

Now, if you’re lucky (or have already installed a separate instance of Ruby on your machine), this is all you have to do. You can check your Shopify version with the command:

$ shopify version

However, if you’re on mac and do not deal with ruby often, it is possible you ran into the following error(s):

/usr/local/bin/shopify: line 2: /opt/homebrew/Cellar/ruby/3.0.1/bin/ruby: No such file or directory
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

No need to fear, we’ll get you up and running in no time. Let’s try a couple things. First, try to update your Ruby version:

$ brew install ruby@3.0

No, go? That’s ok. On to Plan C. In order to use a different Ruby installation, you’ll need rbenv or RVM. I personally used rbenv, so I will be following that guide. I could rehash the installation here, but the most updated version is likely in the github repo itself. So, take a few minutes to set it up, and then head back here for more Shopify fun.

This isn’t mentioned in the guide but you might need to update your bash or zshrc profile. If you’re using bash, follow this guide. Otherwise, but if you’re still having issues update your .zshrc file:

$ sudo nano ~/.zshrc

Inside the file add:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init - zsh)"

Now to make sure everything is working, restart terminal or source your zshrc file:

$ source ~/.zshrc

Determine the verison you need, or latest stable Ruby version by running:

$ rbenv install -l

To install version:

$ rbenv install VERSION_NUMBER_HERE
$ rbenv global VERSION_NUMBER_HERE

You have now made it full circle, and should finally be able to install the Shopify Cli as mentioned in the very first step:

$ brew tap shopify/shopify
$ brew install shopify-cli

Here are some useful commands for once you have the cli installed. I personally use shopify check quite often to make sure my theme is using liquid properly.