Installing Your Pebble.js App on your Pebble Smartwatch With the SDK

Jan 17, 2016

One thing that wasn't immediately obvious for me in my first attempt to create a Pebble.js app was how to actually get it onto my Pebble Time. In this short tutorial, I will show you the steps you need to take to easily accomplish this task. For this, I'll be assuming you have already written your application and now you just want to get it onto your device. If you haven't written your application, I'd suggest checking out the Pebble Developer Site before moving on.

My hardware:

  • Pebble Time
  • iPhone 6
  • Macbook Pro

First, you want to set up your Pebble device. My Pebble watch is connected to my iPhone, so this may slightly differ if you're on an Android device. Open your Pebble application on your phone and tap the hamburger menu (the triple lines in the top left corner). Select the SETTINGS menu and inside you'll see an option called Developer Mode. Switch that to the on position and then click the hamburger menu to go back. Now above the SETTINGS menu you will see a new menu called DEVELOPER (ON). Navigate into that menu and turn on the option called Enable Developer Connections. This will allow you to communicate with your Pebble device with your computer. At this point you're done setting up your device, but you should keep this menu open since you'll need the IP address (listed under Listening on) to actually connect.

Now, using your computer, open a terminal window. I'm using Mac OSx here, so this may differ if you're using Windows or Linux. Also, I'm assuming you've already installed the Pebble SDK. If not, you can find it here. I installed mine using the provided Homebrew method. This provides you with the pebble command. To make sure you have a proper installation, type:

pebble --version

into your terminal window and hit enter. You should see something similar to this:

Pebble Tool v4.0 (active SDK: v3.8.2)

Your versions may be a little different, but as long as you see something that isn't an error, you should be fine.

Next, you'll want to ping your Pebble device. Remember when I said you'll want that IP address? Here's the first time you'll be using it. This step is not required, I just find it's useful to quickly check if you're actually able to connect to your device. To do this, type the following command into your pebble device:

pebble ping --phone IP_ADDRESS

Replace IP_ADDRESS with the IP address from the Pebble app on your phone. Once you've done this, you should see the word "Ping" on your Pebble device, and in your terminal window you should see the word "Pong!" If you see this, you now know that you can connect to your Pebble device.

Next you want to build your application. Pebble applications are built in the C programming language which means you need to compile all of that JavaScript into C. Make sure you navigate into the main directory for your project then type the following command into your terminal window:

pebble build

You'll see a bunch of stuff pop up in your terminal and it may ask you about installing an SDK.. Type y and hit enter. Once the build has completed, the important thing to look for is a new build folder in your main project directory. If there were no errors, and you see the build folder, you can then move onto the next step, which is installing your new application on your device. To do this you'll need that IP address again. Type the following into your terminal window:

pebble install --phone IP_ADDRESS

In the terminal you'll see:

Installing app...
App install succeeded.

In your device, your new app should have automatically opened. Now you can use it just like any other app on your Pebble device.