Even before you can install and use the Zendesk App Tools (ZAT) and other app developer tools like the app scaffold, you must do some preparatory setup on your system. This includes setting up your command line interface and making sure you have Ruby (for ZAT) and Node.js (for the app scaffold). These tools form the foundation of your apps development environment.
This three-part article series describes the system prep for app developers working in both Windows and macOS. Whether you're an experienced programmer or not, you can use the series as a reference. Feel free to leave feedback in the comments section.
This article describes how to set up your command-line interface (CLI). Developers use CLIs for basic tasks such as making cURL requests or installing and using open-source tools such as Ruby and Node.js.
CLIs are also known as shells. The Bash shell is the default command-line shell for macOS as well as for most Linux distributions. It's widely used by developers. You can also set up a Bash shell in Windows 10, as described in this article. All Bash shells share a common command language.
Topics covered in this article:
The other articles in the series cover the following topics:
Setting up a Bash shell in Windows 10
The default command-line interface in Windows can often be a pain-point for developers compared to the Bash shell on macOS and Linux systems. Fortunately, a version of the Bash shell is available for Windows 10.
This section describes how to set up a Bash shell on your Windows 10 computer. The process involves enabling the Windows Subsystem for Linux in Windows 10 and installing a version of Ubuntu from the Microsoft Store. Ubuntu is an open-source operating system that includes the Bash shell as well as other tools such as git and ssh. Ubuntu runs in the Linux subsystem in Windows 10.
To set up a Bash shell in Windows
In Windows 10, enable Developer mode.
To quickly find the setting, type "develop" in the Windows search box on the taskbar and click Use developer features.
After you select Developer mode, Windows searches for and installs the Developer Mode package.
Restart your computer.
Type "PowerShell" in the Windows search box, right-click Windows PowerShell in the results, and select Run as administrator.
You must run PowerShell as an administrator or you'll get a permission error in the next step.
Run the following command in PowerShell to enable the Windows Linux Subsystem:
C:\> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
When prompted, select the option to restart the computer.
Visit the Microsoft Store and download Ubuntu.
After the download is complete, click the Launch button on the Ubuntu page in the store, or click the Ubuntu tile in the Windows Start menu.
Windows opens the console and installs Ubuntu. It may take a few minutes.
When prompted, enter a username and password for the Unix account:
Once you're done, you can start using the Bash shell.
To open the Bash shell at any time in Windows
Open the command prompt by typing
cmdin the search box.
Tip: If you prefer, you can use PowerShell instead of the command prompt.
Run the following command:
- Beginners Bash scripting on the Ubuntu website
- Frequently asked questions about the Windows Subsystem for Linux (WSL) on the Microsoft website
- Install the Windows Subsystem for Linux on the Microsoft website.
Configuring the Bash shell in macOS
The command-line interface on a Mac is called Terminal. To launch it, double-click Terminal in the Applications/Utilities folder. You can drag it to the Dock for easy access.
Terminal opens a Bash shell by default:
Note: All instructions in this section were tested on macOS 10.12, although they should still work for OS X 10.11.
Installing the Command Line Tools
Terminal provides you with a basic shell. However, most developers supplement it with the Command Line Tools from Apple. This small, self-contained package includes many common developer tools normally included in default Linux installations, such as GCC, clang, svn, git, and libtool.
You'll need the Command Line Tools to install Homebrew in the next step.
Note: If you installed Xcode on your Mac, then you already have the tools. They came bundled with Xcode. You don't have to install them separately.
To install the Command Line Tools
Open Terminal and run the following command:
$ xcode-select --install
When prompted, click Install and accept the legal agreement.
Make sure you installed the Command Line Tools before installing Homebrew. They're a requirement. See the previous section.
To install Homebrew
In Terminal, paste and run the following command:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
For more information, see the instructions on the Homebrew site.
Configuring your $PATH variable for Homebrew
Homebrew installs programs in the /usr/local/bin folder. You must tell your system to use a program in that location rather than in the OS default location, if one exists.
To do so, you add /usr/local/bin to the $PATH environment variable.
The Bash shell gets the $PATH variable from a script when starting. The default Bash shell opened by Terminal is known as a login shell, so it gets the variable from a file named .bash_profile. Other terminal emulators may open login shells, but most tend not to. They open what's known as interactive shells, which run a file named .bashrc instead of .bash_profile. You need to create both files.
To configure your $PATH variable for Homebrew
In Terminal, make sure you're in your home folder (the folder in the Users folder named after you), then run the following command:
$ ls -a
This should display all the files and folders in your home directory.
If you don't see a file called .bash_profile or .bashrc, that's ok. You'll create them next.
In Terminal, create the missing files with the following commands:
$ touch .bash_profile
$ touch .bashrc
Make sure you include a period (.) before the filenames. This hides files and folders.
Next, you want to "source" .bashrc from your .bash_profile.
Open .bash_profile in any text editor and add the following lines:
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
Note: If the files are not visible in Finder and you have macOS 10.12.4 or later, select your home folder in Finder and press Shift+Command+period. This toggles files between hidden and visible states in Finder. For earlier macOS versions, see How To Show Hidden Files On Mac OS X Computer on usefulpcguide.com.
Save the file.
In Terminal, run the following command to edit your $PATH:
$ echo >> ~/.bashrc && echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
Reload your shell:
$ source ~/.bash_profile
Check your changes:
$ brew doctor
If everything is in working order, you should see the message, "Your system is ready to brew!"
That's it! When you're ready, continue to System prep for app developers 2: Managing Ruby versions.