Why do I receive an error while trying to "cd" to folders on Mac?

8 views (last 30 days)
This question was flagged by Walter Roberson
On my Mac, I am trying to "cd" to the to the Desktop folder in MATLAB using the command below:
>> cd /Users/myusername/Desktop
However, I am encountering the following error:
Error using cd 
Unable to change current folder to '/Users/myusername/Desktop'
The error does not occur when trying to navigate to other folders, such as /Users/myusername/Documents.
What is happening here? How can I fix this issue?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Apr 2025
Edited: MathWorks Support Team on 5 Apr 2025
The underlying issue is related to the application permissions within your operating system. Specifically, on macOS, applications are granted access to specific folders, and it seems that MATLAB currently lacks permission to access the Desktop folder.
To address this problem, you need to grant MATLAB the necessary access permissions. You can do so by following the instructions in Control access to files and folders on Mac and/or Controlling app access to files in macOS.
We also recommend giving MATLAB "Full Disk Access" by going through Apple menu > System Settings > Privacy & Security > Full Disk Access, as indicated in the picture below:

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!