Why I Get a No Such File or Directory Error on macOS

In the terminal in macOS, I can execute certain commands manually. I'd like to create a simple script that I can run through the Terminal shell. But when I run this, I get the following error: zsh: no such file or directory.

Best Answered by

Jaden· Answered on Aug 20, 2024

First, check that your command line in the script is in the correct format. PATH is a list of directories in which commands can be found, separated by colons. The path in the command you use that doesn't work may be explicitly quoted and preceded by "~/." When you do that, the system searches for \/ as a literal path rather than the extended path of the user's home directory.

Basically, zsh will run the initial find and try your command name with each path. There won't be an zsh commandf not found error message if any of the specified folders are missing; instead, zsh will fail to locate a binary there and go on to the next one.

Moreover, you risk losing your files and data if the zsh tools are accidentally upgraded or commands are entered erroneously. Therefore, it would be advantageous to be vigilant in securing your data. This excellent data recovery tool is EaseUS Data Recovery Wizard for Mac.

Note: To prevent more data loss, you should make a backup of your Mac by clicking "Disk Backup" on the left sidebar before trying to recover your data. 

Step 1. Click "Search for lost files" after selecting the drive from which you need to recover lost or deleted files.

Step 2. If you are searching for a specific file, you can sort the scanned results to locate it.

Step 3. View the files, then select "Recover" to recover your lost or lost Mac files.

Finally, if you cannot access files or applications in a certain directory on Mac, confirm again whether administrator rights are required to access the target.

Use EaseUS Data Recovery Wizard to recover deleted or lost files easily and quickly.

Tutorials on how to recover lost, deleted, or formatted data from HDD, SSD, USB, SD card, or other storage media on Windows and Mac.

People Also Ask

[Solved] How Can I Recover Permanently Deleted Files from Mac

This post will discuss how you can recover permanently deleted files from a Mac in 3 effective ways: EaseUS Data Recovery Wizard for Mac, Time Machine, or iCloud.

Brithny

Aug 29, 2024

Can I Recover a Corrupted Numbers File? HELP

If you have encountered Numbers file corruption on a Mac or MacBook, it's better to apply a reliable file repair program. Check the answer to find out how to recover a corrupted Numbers file with EaseUS Fixo Document Repair.

Dany

Jul 26, 2024

[Free] Recover Unsaved Word Document on a Mac

This post will introduce how to recover an unsaved Word document on a Mac with effective methods. Read on to learn the detailed information!

Brithny

Aug 20, 2024

How to Fix Archive File Is Incomplete Mac

If you have ever encountered the same question, like archive file is incomplete Mac when you unzip files on Mac, this post may help you with it.

Finley

May 09, 2024

How to Open External Hard Drive on Mac with Terminal [2024 Tips]

In this post, you'll discover how to securely manage your external hard disk using Mac's Terminal commands. Download this free Mac data recovery program to restore up to 2 GB of files in the event that you unintentionally delete your files or format the wrong drive using Terminal commands.

Jaden

May 09, 2024

How to Fix PowerPoint Keeps Crashing on Mac

This post will look at one of the most effective ways to solve PowerPoint keeps crashing on Mac. Follow the instructions and get it fixed.

Finley

May 09, 2024