Xcode not found in the PATH and expo cannot run iOS simulator

0 votes

I messed up my PATH and expo no longer recognises Xcode being installed. I know that it is because of the PATH and I tried most of the suggestions here on Stack and the problem got worse.

Firstly, every time I open a terminal I am prompted with these messages:

Last login: Wed Feb 15 19:25:08 on ttys001
/etc/zshrc:7: command not found: locale
/etc/zshrc_Apple_Terminal:104: command not found: mkdir

When I write which expo I am prompted with /opt/homebrew/bin/expo.

When I write which Xcode I am prompted with xcode not found. :(

When I type echo $PATH I am prompted with all this:

/opt/homebrew/bin:/opt/homebrew/sbin:export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

As the initial problem was with (AWS) amplify pull command not being recognised, I followed the steps in this thread to write on the .zprofile so I typed :

2. vim .zprofile
3. Press i, then paste this line
export PATH="$HOME/.amplify/bin:$PATH" 
4. Press Esc and :wq to save this file

Then I changed stuff again following this thread and I understand now how to add export PATH=/opt/homebrew/bin/ but it disappears when I close the terminal.

Also, neither vim nor ls are recognised commands.

Question 1: Is there a way to restore my system variables and PATH to a default?

Question 2: How could I change my path for expo to see the application installed and run the simulator?

Question 3: How do I make it permanent/save it?

I would be forever grateful for any support, because there has been 2 days of frustration now.. :((

Please help!

Feb 16, 2023 in AWS by Ashwini
• 5,430 points
432 views

1 answer to this question.

0 votes

It sounds like you've encountered a few issues with your PATH and environment variables, but don't worry - we can help you get things sorted out.

Answering your questions:

Q1: Is there a way to restore my system variables and PATH to a default?

Yes, there is a way to restore your system variables and PATH to the default settings. One way to do this is to open a new terminal window and check what the default PATH should be by running the command echo $PATH. Once you have the default PATH, you can override your existing PATH by running the following command:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

This will set your PATH to the default settings.

Q2: How could I change my path for expo to see the application installed and run the simulator?

You can add the path to Xcode to your PATH variable by running the following command:

export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Tools"

This assumes that Xcode is installed in the default location. If it's installed somewhere else, you'll need to adjust the path accordingly.

Q3: How do I make it permanent/save it?

To make the changes to your PATH permanent, you'll need to add the export commands to a file that gets sourced every time you open a terminal window. In the case of the zsh shell, you can add the commands to the ~/.zshrc file. To do this, run the following command:

echo 'export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Tools"' >> ~/.zshrc

This will add the export command to the end of your .zshrc file. From now on, every time you open a terminal window, the command will be executed and the Xcode path will be added to your PATH.

Regarding the issues with vim and ls not being recognized commands, it's possible that these commands are not installed on your system. You can install them using a package manager like Homebrew by running the following command:

brew install vim
brew install coreutils

I hope this helps you get things back on track!

Ready to level up your coding game? Uncover the realm of microservices with our cutting-edge Microservices Developer Certification!

answered Feb 17, 2023 by sarit
• 1,830 points

Related Questions In AWS

+7 votes
1 answer

Error: Path not found

try using the following command aws s3 cp ...READ MORE

answered Sep 20, 2018 in AWS by Priyaj
• 58,090 points
797 views
0 votes
0 answers

Unix xxd -r -p command NodeJS equivalent

I'm attempting to convert an encrypted shell ...READ MORE

Jun 9, 2022 in Node-js by Vaani
• 7,020 points
289 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,632 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,202 views
0 votes
1 answer

DMZ kind of network design in the AKS

It sounds like you want to implement ...READ MORE

answered Feb 17, 2023 in AWS by sarit
• 1,830 points
379 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP