Skip to content

Command Line Usage

Zong Huang edited this page Jun 10, 2019 · 21 revisions

Our template repository assumes that you have command line usage set up for the core tools used in our projects. This allows us to use the GSLab Make library to run multiple applications in a single build script.

To set up an application for command line usage, its executable must be added to the system environment variable PATH so that your operating system can locate it. We provide instructions on how to add an executable to PATH for Mac and Windows.

Mac

By default, our template repository assumes the following executable names for the following applications:

application : executable
Python      : python
git-lfs     : git-lfs
LyX         : lyx
R           : Rscript
Stata       : statamp (will need to be updated if using a version of Stata that is not Stata-MP)

While these are the standard executable names for Mac, it is possible that they may differ on your computer. Default executable names can be updated in config_user.yaml. For further detail, see discussion on the configuration files page.

To check if an application is setup for command line usage, type which executable into a terminal. If no path appears, then the application is not setup for command line usage. To add the executable of an application to PATH:

  1. Locate the executable for an application. For example, the executable for Stata is typically found at /Applications/Stata/StataMP.app/Contents/MacOS/statamp. (To open an .app, right click and click Show package contents.)

  2. In a terminal, from your user directory (/Users/name) run the following bash commands:

    touch .bash_profile
    nano .bash_profile
    
  3. The Nano editor should appear in your terminal. Type in the path to the executable into the Nano editor in the following format export PATH="$PATH:path_to_executable where path_to_executable refers to the full path of the directory containing the executable.

    For example, if your Stata executable was located in /Applications/Stata/StataMP.app/Contents/MacOS/statamp, you would want to type in the following text into the Nano editor: export PATH="$PATH:/Applications/Stata/StataMP.app/Contents/MacOS".

  4. Save and exit the Nano editor by pressing CTRL + X, Y, and enter.

Windows

By default, our template repository assumes the following executable names for the following applications:

application : executable
Python      : python
git-lfs     : git-lfs
LyX         : lyx
R           : Rscript
Stata       : statamp

However, these are the default executable names for Mac and therefore likely to differ on your computer. Default executable names can be updated in config_user.yaml. For further detail, see discussion on the configuration files page.

Executable names for Windows will typically look like the following:

application : executable
Python      : python
git-lfs     : git-lfs
LyX         : LyX#.# (where #.# refers to the version number)
R           : Rscript
Stata       : stata_executable

stata_executable refers to name of your Stata executable. For example, if your Stata executable was located in C:\Program Files\Stata15\StataMP-64.exe, you would want to type in the following into your config_user.yaml: stata: StataMP-64. You would then want to add your Stata executable to PATH.

To check if an application is setup for command line usage, type where executable into a terminal. If no path appears, then the application is not setup for command line usage. To add the executable of an application to PATH:

  1. Locate the executable for an application. For example, the executable for R might be found at C:\Program Files\R\R-3.5.0\bin\x64\RScript.exe.

  2. In your start menu, search "environment". Click on Edit the system environment variables.

  3. Click on Environment Variables. You should see a panel that is labeled User Variables. In the panel, click on the variable called Path.

  4. Click on Edit. Click on New.

  5. Type in the full path of the directory containing the executable.

    For example, if your R executable was located in C:\Program Files\R\R-3.5.0\bin\x64\RScript.exe, you would want to type in the following text: C:\Program Files\R\R-3.5.0\bin\x64\

  6. Click OK.

Clone this wiki locally