Introduction: Share,Edit,Create Files for Your Raspberry Pi From a MAC

This tutorial will guide you through opening up the files from your Pi so you can easily write code from your laptop as oppose to trying to edit code via the terminal. Note this is a great alternative to VNC and SSH! Using FUSE SSH filesystem software, the process allows your Pi to show as an external drive connected to the Mac, allowing for easy drag-and-drop functionality between the two devices.

Note this only works for MAC but if you are a Windows user etc and know of an alternative to reach the same goal post up the tutorial!

Step 1: Download Atom Text Editor

Download Atom text editor from this link also know as the also know as the “21st Century hackable text editor”

My reason for picking Atom is it's simplicity & Cross-platform editing functionality across operating systems such as : OS X, Windows, or Linux

Step 2: Know the Current IP Address of Your Pi

Usually the IP adress is easy to find by typing

  • hostname -I

on the Terminal of the Pi or via SSH

Step 3: Download SSHFS and FUSE

On your laptop go to

the OSXFUSE website

Download 2 programs SSHFS and FUSE for OS X. Make sure to double click the programs once they have downloaded to run through the installation process for both of them

Step 4: Creating a Folder Where the Pi's Files Will Be Mounted

On your laptop create a folder in the location you want the Pi’s files to be. I created my folder under Documents. It is recommended that you name the folder “Mount” to follow the instructions will less fuss but feel free to rebel.

Step 5: Mount the Raspberry Pi File to Your MAC

Open Terminal on your laptop and type the following manually : (NOTE errors occur if you copy the text bellow so manually type it). When asked for your password type it in should be raspberry unless you changed it!

  • sshfs pi@PiIPAddress:// ~/Documents/Mount -ovolname= Mount

explanation:

pi@PiIPAddress : replace this line with the the IP Address of your Pi

~/Documents/Mount : is the path to the folder named Mount!

-ovolname= Mount : not mandatory - this gives the name Mount to your folder (otherwise a weird name shows up)

Step 6: If You Encountered an Error

If you encounter an error I suggest going over to the terminal to check the exact location on where you created your Mount folder: type

  • ls -a

this will list all the folders you have. Navigate to the folder where you put the Mount folder (in my case it was Documents) so type:

  • cd Documents

then type

  • ls

again and confirm there is a Mount (in our case there is!)

If the error persists triple check your Raspberry Pi IP Address is correctly typed

Step 7: If You Successfully Mounted the Pi

Now if you navigate back to the Mount folder you will see it will have little people on it as well as an arrow next to it which means the Raspberry Pi Files are accessible to us!

Step 8: Open the Pi Files Using Atom the Text Editor

Next on your laptop open up Atom ( the program we downloaded in step 1)

Select File —> Open, then navigate to your Mount folder and select open !

Step 9: All the Raspberry Pi Files Should Be Accesible

You can now view and edit all your Python scripts etc from the Atom Editor!

The code here is from a tutorial I followed from Tony D’s Desk from Adafruit who showed how to turn an LED on or OFF via a web browser here is : his tutorial

Step 10: Unmount the Files

When you are done editing files (make sure you save your code) simply go back to the Mount Folder.

Click the black arrow. The little people on the disk image will go away and the folder will turn blue.

Close Atom and turn off your Pi.

To connect again follow step 5!

Comments

author
russ_hensel made it! (author)2016-11-01

For windows ( and I think it would work on mac and linux ) I do something similar, but use a network drive as the common drive. This can be seen in the Python Autoexec for Your Raspberry Pi: https://www.instructables.com/id/Python-Autoexec-fo... in the Python code under the comment "mount a nas drive". Also meshes with you instructable "Automate a Python Script to Run on Boot"