Arduino CLI: Text-based user interface & command line developer tools

Published By

Arduino's "classic" IDE has been used for coding a wide array of projects, from simple sensors, to robots, and more. While extremely well documented at this point, it's also sometimes maligned for having a somewhat limited interface. The good news is that there are other options available, including the Arduino Pro IDE, and Visual Studio Code. Yet another option is the Arduino CLI, the Arduino Command Line Interface.

As the name implies, Arduino CLI isn’t an "environment" in a graphical sense, as much as it's a set of tools you can access from the command line on your Windows, macOS, or Linux computers. This allows you to create a new sketch with a few strokes of the keyboard, edit in your favorite text editor, and upload it to your Arduino board – with a few more keyboard punches. While it's certainly not for everyone, if you're more comfortable in a terminal than swiping a mouse left and right, then this is a great option to have.

Perhaps the real selling point of such a setup is the interoperability with different pieces of code. It has a JSON interface that can parse output for the command line, can be integrated with make files, and used to automate compilation of Arduino code. The CLI is capable of integration with different IDEs, and gives the advanced programmer a few previously unavailable basic tools to work with.

If this sounds interesting, let's discuss the simple process of installation:

How to install Arduino CLI

On Windows-based systems, simply download the pre-built binary from Arduino's GitHub.io page, extract it, and place it in the directory of your choosing. To try this out, open the command prompt and navigate the directory where the CLI executable is stored, then run arduino-cli.exe. This will give you some hints as to how to use it. You can also run arduino-cli sketch new NewSketchName to create a new sketch/directory.

To enable yourself to use this command everywhere, set up your system up so the Path environment variable includes the directory where the Arduino CLI binary resides.

Install Arduino CLI on Mac

On macOS systems, the process is largely the same. Download the Mac OSX package, unzip it, and place it in an accessible directory. Navigate to that location in terminal. Then run the command arduino-cli. You'll also want to set things up with your environment path, as with Windows systems.

Arduino CLI Image 1

On macOS, it may be easier to set things up via the Homebrew package manager. If you don't already have it available, open up the terminal and enter the following:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once you've done that, enter the commands:

brew update, then brew install arduino-cli

You'll immediately be able to run arduino-cli from different directories. The same Homebrew procedure is listed as a Linux installation option, as well. I personally haven't tried it under Linux, but given my good macOS experience, it would be where I'd likely start.

Arduino CLI: a text-based user interface solution to automation

Once you can open this simple text-based user interface, you'll be able to accomplish a wide range of tasks, such as creating a new sketch, checking whether a board is attached, adding support for boards, and uploading firmware. You can then automate these tasks as you see fit. You'll be able to integrate them with other software, too. While this tool is perhaps best suited for advanced users, it gives you a place to work from, when more established graphical methods don't quite suit your needs.

newsletter 1


Latest News

Sorry, your filter selection returned no results.

We've updated our privacy policy. Please take a moment to review these changes. By clicking I Agree to Arrow Electronics Terms Of Use  and have read and understand the Privacy Policy and Cookie Policy.

Our website places cookies on your device to improve your experience and to improve our site. Read more about the cookies we use and how to disable them here. Cookies and tracking technologies may be used for marketing purposes.
By clicking “Accept”, you are consenting to placement of cookies on your device and to our use of tracking technologies. Click “Read More” below for more information and instructions on how to disable cookies and tracking technologies. While acceptance of cookies and tracking technologies is voluntary, disabling them may result in the website not working properly, and certain advertisements may be less relevant to you.
We respect your privacy. Read our privacy policy here