Quantcast
Viewing all articles
Browse latest Browse all 1123

Configuring the PATH System Variable

Configuring the PATH System Variable a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t1298

Introduction

A path is the name of a file's directory, which specifies a unique location in a file system. Whereas, the PATH system variable ($PATH), specifies a set of directories where executable programs are located. This allows software applications to access commonly executed programs.

There are different methods for modifying the ($)PATH variable on various operating systems. The directions below are based on the most common methods for each operating system. For more information, just use your favorite search engine with the keywords: path system variable along with <the name of the OS you are working on>.

Windows 10

In Windows 10, the PATH system variable is configured through the System Properties window. There are various methods for users to access the System Properties window; for example, users can search view advanced system settings from the taskbar ⊞ Start menu.

Searching view adva from the taskbar⊞ Startmenu, to access the the System Properties window. (Click to enlarge)

Once the System Properties window has been pulled up, select the Environment Variables... button from the Advanced tab.

Opening the Environment Variables window. (Click to enlarge)

Within the Environment Variables window, select the Path variable from the User variables for <username> section. Then, select the Edit... button to configure the PATH system variable.

Note: The User variables are specific for a user account on the computer; while, the System variables will be available for all accounts on the computer.

Opening the PATH system variable window. (Click to enlarge)

From the PATHEdit environment variable window, select the Browse... button. Once the pop-up dialog box appears, navigate to the folder containing the executable file to be included in the PATH system variable.

Note: Make sure not to select and overwrite a previously configured file path. Users can click on the black space area to make sure that a previously configured file path isn't highlighted and therefore, won't get overwritten.

Adding a directory to the PATH system variable. (Click to enlarge)

Mac OSX and Linux Based Systems

On Mac OSX and linux based systems, users can display the paths for the $PATH system variable by entering echo $PATH into the terminal.

Note: The commands below use the GNU nano text editor. Feel free to use another text editor of your choice (such as vi for Vim).

To modify the variable:

  1. Open up Terminal and run the following command to edit the paths file: sudo nano <file path location>
    • There are several locations where users might be able to modify the $PATH system variable:
      • /etc/paths (Mac OSX - Mountain Lion)
      • /usr/bin
      • /usr/local/bin
      • /usr/local/sbin
      • /usr/sbin
      • ~/.bash_profile
      • ~/.bashrc
      • ~/.profile
  2. Enter the super user (administrative) password, if prompted.
  3. Enter the modifications for the path you wish to add.
    • The entry field is usually near the bottom of the file.
  4. Hit Ctrl+X to quit.
  5. At the input prompt, send Y and hit Enter or Return to save the modified buffer.

Displaying paths of $PATH variable and accessing the ~/.profile file for modifications. (Click to enlarge)

That’s it! To verify the changes, in a terminal window, type: echo $PATH

Note: Another common method is to use the export command in the terminal.

Example: export PATH=$PATH:<file path to be added>

Resources and Going Further

Looking for some additional programming related tutorials? Check out the guides below:

Alternative Arduino Interfaces

We admit the Arduino IDE isn't for everyone. Here are some other options for programming your Arduino boards, including web interfaces and graphical programming languages.

Digital Sandbox Arduino Companion

Let's take the same examples from the ArduBlock-based Digital Sandbox guide, and implement them using Arduino code.

Simon Says Experiments

So you've built up a Simon Says kit? What next? This tutorial will get you up and running with Arduino software, guide you through a few example sketches, and send you on your way to create your own. Careful, this stuff is highly addictive. :)

How to Run a Raspberry Pi Program on Startup

In this tutorial, we look at various methods for running a script or program automatically whenever your Raspberry Pi (or other Linux computer) boots up.

learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>