Installing an Arduino Library
Manually Installing a Library - Mac
This section covers manually installing a library under the Mac OS X environment. If you’re more of a text learner then check out the Arduino tutorial on installing libraries.
We are going to use the Capacitive Sense library for this example. Navigate to the library’s page and download the zip file.
Find the zip file on your local computer (wherever downloaded files end up). Unzip it, and look at the folder contents.
This particular library contains libraries for both the basic Arduino and the more advanced Arduino Due. You can use both if you’d like, but, for this example, we will be copying and installing only the CapacitiveSensor folder.
Now we need to add this folder to the Libraries folder for Arduino. This folder is somewhat hidden in OS X. To get there you can do one of two things. Option one, right-click on the Arduino icon located in your Dock. Go up to 'Options', then click 'Show in Finder'.
Option two, find the Arduino app located in your applications folder within Finder. Now, right-click on the Arduino app, and select 'Show Package Contents'. Either option should get you to this point.
Navigate through the following folders, 'Contents -> Resources -> Java', until you reach the 'libraries' folder.
Inside the libraries folder is where you want to copy/move the library folder you just downloaded and unzipped. You'll also notice this is where all the default libraries live as well as any other libraries you may have installed in the past.
Next, make sure that restart the Arduino IDE if it was open when you installed the library. This is a very important, often overlooked step. If you don't restart, the library you just installed will not yet be available to the IDE.
To verify the library has been installed correctly, open up the 'File > Examples' folder under the Arduino IDE.
There it is! Let’s open the example provided with our new library.
Examples are the greatest thing about libraries! Good libraries will have well written examples showing how to use the library. These sketches are wonderful resources for example code and learning how to write good code under Arduino.
You now have the Capacitive Sensor library installed! Feel free to start from the example sketch, or begin writing your own code using the functions provided by the library. A library usually has documentation either on its site or written into readme files and example code. In general, to quickly learn how to use a library check out the example code.