Skip to content

Using the BBB on Mac

Franz Miltz edited this page Aug 7, 2021 · 1 revision

Using the BBB on Mac

Note: BBB is a short form for BeagleBone Black.

Note: To be able to connect to the BeagleBone from your computer, the operating system of the BBB must already be installed on your computer. If this is not the case, please follow the guide for that first before continuing.

To compile your project onto the BBB, you will need to learn how to connect the BBB to your Mac and mount the BBB file system onto your Mac as well. At the end of this guide, there are instructions for adding aliases (basically shortcuts) to avoid typing out command line functions repeatedly. Also, check out the guide on using the crosscompiler here to make compiling easier and faster.

Summary of the guide:

  • User: hyped

  • Password: spacex

  • BeagleBone IP Address on Mac: 192.168.6.2

To connect via ssh:

$ ssh hyped@192.168.6.2

To mount the BeagleBone:

$ sshfs hyped@192.168.6.2: /your_own_mount_point/

To safely unmount:

$ fusermount -uz /your_own_mount_point/

Step 1. SSH

  1. Mac comes with SSH preinstalled but however, its default setting is disabled. To ensure it is enabled, run the following command in the command line.
$ sudo systemsetup -setremotelogin on
  1. Connect the BBB to your computer using the USB cable. This will cause the BBB to power on and some blue lights will start flashing. Allow ample time for your Mac to recognize the BBB. You can check this by opening Finder and waiting for BEAGLEBONE_BLACK to appear on the side.

  2. In a new terminal window, type the following command:

$ ssh hyped@192.168.6.2
  1. You will then be prompted to enter Hyped's password, which is: spacex.

If this is your first time connecting to the BBB, you will get a warning message which is normal. Just continue and your computer will be connected.

If you are prompted with an error message (something along the lines of "SOMEONE TRIED TO BREAK INTO THE SYSTEM"), then see the Troubleshooting section below.

Step 2: Mounting the file system

You will be mounting the BBB file system onto your Mac, which will allow you to move the project directory and other various files onto the BBB.

  • WARNING: when running and debugging the project on the BBB (when mounted), be aware which files you are editing as files edited on the BBB will be lost when turned off.

To do this, launch a new terminal (on your computer and is not connected to the BeagleBone) and decide where you want to put the BBB. For example, on my computer, it is in: /home/meina/Documents/HYPED/BBB

You will need to create a directory/folder to hold the mounted file system. Change directory to where you want the directory/folder to be. For example, I want the folder that will hold the mounted file system to be in my HYPED directory. I will run:

$ cd /home/meina/Documents/HYPED

Then create the directory:

$ mkdir BBB

Once you have done that, you can use the sshfs command to mount the BBB to this directory. If sshfs is not installed on your computer, you will need to install it. The easiest way is to use Homebrew: $ brew install sshfs. If you don't have Hombrew, install it asap, since it's by far the best and easiest way to install packages on a Mac (not just for HYPED things!).

The command for sshfs is as follows:

$ sshfs user@address: /your_own_mount_point/

In my case, I will run:

$ sshfs hyped@192.168.6.2: /home/meina/Documents/HYPED/BBB/

After entering the password, you should not get any other output. You can now edit/view the files in your own text editor as well as drag and drop files onto the BBB.

If you get other output saying that you can't connect to the BBB, then see the Troubleshooting section below.

Note: The mount point must be either the absolute file path to the directory in which you want to mount the BBB or the relative file path from your current directory.

Note: Remember that the files that you mounted are only stored on the BBB and not on your computer. So as soon as you power off the BBB, the files that were mounted there will disappear.

Step 3: Unmounting the BeagleBone

To safely disconnect the BBB, don't unplug it right away. If you have mounted its file system,you can run the following command to safely disconnect it:

$ diskutil unmount force <path_to_mount_point>

Then press the labelled power button above the usb cable to turn it off before unplugging.

Troubleshooting:

If you have connected to a different BeagleBone before and try connecting again, your computer might not let you.

The solution for this is to enter the following command in the terminal:

$ ssh-keygen -R 192.168.6.2

This will reset your computer's memory of previous devices at that IP address and allow the connection to the new device.

Setting up aliases

  • Typing in these commands is a pain when you need to use the BBB repeatedly. This section will teach you how to manipulate bash script on your Mac to save these various commands of this guide to your Mac.
  1. Open a new terminal and navigate to your home directory:
$ cd
  1. Type the command ls -a and a list of files will appear. There should be a file called .bash_profile. Open that file in terminal with nano:
$ ls -a
$ nano .bash_profile
  1. Within this script, type the following lines below the preexisting text. Make sure to replace <insert_path_here> with the path to the mount directory you created earlier.
BBB=192.168.6.2

alias sshclean="ssh-keygen -R $BBB"
alias sshBBB="ssh hyped@$BBB"
alias sshfsBBB="sshfs hyped@$BBB: <insert_path_here>/mount"
  1. To exit nano, press command+x, then hit enter twice when prompted to save the script
  2. You need to make sure the script is sourced in terminal. To test this, close the terminal window and open a new terminal window to its home directory.
  3. Type the following command to if it is sourced:
$ echo $BBB
  1. The output should be 192.168.6.2. If not, type the following command to source the .bash_profile script:
$ source ~/.bash_profile
  1. Congratulations! You have successfully shortcut commands for the BBB. Next time you connect to the BBB, use sshclean, sshBBB, and sshfsBBB instead of their longer, equivalent commands you learned above.

Connecting to the internet on the beaglebone

Check this link out -> https://superuser.com/a/1164628

Clone this wiki locally