./main
zsh: no such file or directory: ./main
If you are trying to run a Rust Language program on your Terminal and you get "no such file or directory", well there could be two reasons for this error,
- You have not compiled your program yet, hence the complied file is not yet created. You can compile your Rust Program file as follows,
rustc <file-name.rs>
- If you think you have completed your file, then make sure that file exists at the location you are running it. Do a dir or ls command in the Terminal/Command Prompt to check based on your Operating System (Windows or Mac/Linux respectively).
ls -ltrh total 824 -rw-r--r--@ 1 c2ctech staff 43B Jul 18 07:10 main.rs -rwxr-xr-x 1 c2ctech staff 407K Jul 18 07:49 main
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to Rust,
- Rust: Cargo Init vs Cargo New Command
- Rust: Write and Run Hello World! Program Example
- How to Split a String using Rust Language
- How to Sort a Vector in Rust with Examples
- Fix: error: could not find `Cargo.toml` in Users or any parent directory
- How to uninstall Rust Language from Mac/Linux/Ubuntu
- How to update Cargo (Rust Lang)
- Fix: rust-analyzer failed to discover workspace [Visual Studio Code]
- How to install Rust using rustup on macOS/Linux/Ubuntu
- Cargo Watch: To Recompile Rust Project Automatically
- Difference between rustc and cargo build commands
- How to Split a String by Space in Rust
- How to know Rust is Installed on Mac?
- Rust: zsh: no such file or directory: ./main
- How to update Rust on Mac/Linux
- List of Rust Cargo Commands
- How to find version of Cargo in Rust
- Fix: error: mismatched closing delimiter } [Rust]
More Posts:
- Setting and Updating AWS CLI Configuration - AWS
- List of Special Parameters/Variables in Bash Shell Scripting - Linux
- Convert String from uppercase to lowercase in Bash - Bash
- List all installed packages (Formulae) in Homebrew on Mac - MacOS
- How to repeat background image in Android Activity - Android
- Add days/weeks/months/years to LocalDate in Java 8 and above examples - Java
- How to Open .bash_profile file in Mac Terminal - MacOS
- The tag img may only appear as a descendant of tag noscript. Did you mean amp-img - AMP