Raspberry Pi

How to SSH into Raspberry Pi from Mac

Raspberry Pi allows users to have remote access the device through Secure Shell (SSH), which is an encrypted communication mostly used to access the Raspberry Pi terminal. It doesn’t require connecting a monitor to Raspberry Pi for the display, instead, you can control Raspberry Pi from any other device including your phone or laptop.

For Mac users, this article is a detailed guide to SSH into Raspberry Pi and using the terminal to run commands on the system.

How to SSH into Raspberry Pi from Mac

To access the Raspberry Pi through SSH from Mac, follow the below-written steps:

Step1: Enable SSH on Raspberry Pi

Before accessing the Raspberry Pi from Mac, you must enable the SSH service on Raspberry Pi system from the following two methods.

1: GUI Method

To enable SSH from the GUI, go to the “Raspberry Pi Configuration” from the “Preferences” in the Application Menu.


Then go to the “Interfaces” tab.


Drag the SSH button to the right to enable it on the Raspberry Pi system.


After enabling, click on the “OK” button.

2: Terminal Method

You can also enable SSH on Raspberry Pi from the terminal as well by opening the Raspberry Pi configuration using the following command:

$ sudo raspi-config

 

Then go to the “Interface Options” and press enter to select it:


Now select the SSH option and press Enter:


Then enable SSH by selecting “Yes” on the prompt window.


A prompt will appear to confirm the SSH enabling.


Now enter Finish to end the enabling process:

Step 2: Finding the Host IP

After enabling the SSH, you must find the host IP of our Raspberry Pi so that you can access the Raspberry Pi system from Mac. To find host IP, use the following command:

$ hostname -I

 
The IP address will be displayed as an output of the above command

Step 3: Accessing the Raspberry Pi from Mac

Finally, you can SSH into Raspberry Pi through Mac and for this reason, open the z-shell on Mac and type the below-given command along with the Host IP.

$ ssh pi@<IP-Address>

 
In my case my IP address is “192.168.18.67”, which I have used as shown below:

$ ssh pi@192.168.18.67

 

After entering the above command, it will ask you for a password, the password is the same as your Raspberry Pi system’s password. Type the password and press Enter.

Note: You may not be able to see the Password characters displaying after typing for security purposes.

Once the password is entered correctly, you can login to Raspberry Pi from the terminal of Raspberry Pi through SSH using MacBook:


Now you can run any of the commands you want to run, for instance here I have used ls command to display the content of Raspberry Pi through Mac:

$ ls

 

You can run as many commands as you want.

Exiting The SSH Connection

To exit the SSH, just type the exit command and you will shift back to your Mac shell:

$ exit

 

Conclusion

To SSH into Raspberry Pi from Mac, first enable it on Raspberry Pi through the GUI or terminal. Then using the “hostname -I” command to find out the IP address of your system. After that, you can open the z-shell on Mac and type the command “ssh pi@ <IP address>” to access the Raspberry Pi using the Raspberry Pi password.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.