Basic terminal commands not working after trying to install Composer - macos

My mac terminal is completely dysfunctional! Every time I open terminal I get this message:
-bash: export: `/Applications/MAMP/bin/php/php5.5.10/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin': not a valid identifier
The problem came about a while ago, I believe I was attempting to install composer to work with MAMP.
Today I started a beginner tutorial on how to use the Terminal and almost every command does not work such as the basic mkdir , ls , and touch (to make folder, list items, and make a file respectively), (screenshot attached).
I have already tried deleting the ~/Library/Preferences/com.apple.Terminal.plist file. Your help is greatly appreciated.
I am working with Mac OS X 10.10.2
screenshot of terminal after making basic commands

It looks like you have an error in your .bash_profile or other startup script. Open it on terminal using vi ~/.bash_profile or some other editor of your choice and comment out that line, then type source .bash_profile to reload it.

Related

zsh: permission denied: webstorm - On Attempting to Create Shell Script That Launches WebStorm

I am following the documentation on creating a Shell script that launches the WebStorm application for a given file folder as described on WebStorm Help page. I am currently using an M1 Pro Macbook (2022) that I just got today and has little else installed beyond Homebrew, VSCode, WebStorm, and PyCharm.
Following the example in the docs, I created a file called webstorm (without any extension) in usr/local/bin and added the following code to it:
#!/bin/sh
open -na "WebStorm.app" --args "$#"
After starting up a new terminal, and running webstorm ., I get the following error in my terminal:
zsh: permission denied: webstorm
I have:
Changed sh to zsh as my default shell is zsh, and that made no difference.
Checked my permissions for both usr/local/bin and usr/local/bin/webstorm to ensure that I have the correct permissions to execute files from here. When right clicking on the webstorm file and clicking "Get Info", I can see that I currently have read and write permissions.
Restarted my computer
To add to my confusion, I have used the same script in the same location on my work Macbook, and it has worked without issues.
Any help on this would be hugely appreciated.
Checked my permissions for both usr/local/bin and usr/local/bin/webstorm to ensure that I have the correct permissions to execute files from here. When right clicking on the webstorm file and clicking "Get Info", I can see that I currently have read and write permissions.
Do you have the "execute" permission?
Try:
$ chmod +x /usr/local/bin/webstorm

Trying to run a Unix-exec file via MacOS Terminal results in "zsh: exec format error"

I'm on MacOS BigSur 11.4. I'm trying to run an executable file to start a Minecraft server from a folder of set up files associated with a Minecraft/Python coding book (https://nostarch.com/programwithminecraft).
My order of operations has been. 1) I moved to the file's path via cd/, 2) set the file's executable bit via: chmod +x ./NAME_OF_THE_FILE, and 3) try running the following command to execute the file: ./NAME_OF_THE_FILE
Another post advised that once I run those commands, going forward I just need to run the third command while in the files path. However, no matter how many things I try to I keep getting a "zsh: exec format error."
I suspect this has something to do with the book's publication being in 2015 when the current version of MacOS was Mountain Lion, which was before they switched from bash to zsh with all releases successive to Catalina. This would suggest I'm just formatting something wrong in a way that conflicts with the zsh syntax, but I can't figure it out. I'm searching around zsh format error related posts and they all discuss actions and conflicts that seem only tangentially related to my issue. Any help appreciated.
Thank you

Why did my terminal suddenly has darwin13 as host? How do I fix this?

I was trying to install Kaggle but then all of a u sudden I see:
#x86_64-apple-darwin13 on my terminal.
How do I switch this back? I was trying some solutions I found online but every time I run open ~.bash_profile it says:
zsh: no such user or named directory: .bash_profile
Every time turn on terminal, conda will be activated automatically.
Try the following command should work
conda config --set auto_activate_base false

iTerm and terminal fail immediately on Mac - 'BrokenPipe'

This happened right after I tried to install pyenv and then virtualenvrapper.
As soon as I open iTerminal I get a "Broken Pipe" message and macOS terminal also shuts down immediately.
I have been trying to debug my .bash_profile but uncommenting one after another but without avail
I tried updating homebrew and bash but no change (using a previously open iterm session)
I restarted my computer with the unfortunate effect that I can't access iterm or terminal now (all old sessions closed)
I am quite at loss here now, I have no clue why this happened and how to go about fixing it without having a functioning terminal.
I'd appreciate any advice or pointers.
Following #user1934428 advice I added set -x to all the bash startup files, unfortunately was still met with the same problem. Changing the startup shell in the terminal preferences didn't work.
Thankfully when using emacs ansi-term I was able to get some information/feedback message:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
Following the link I found that default shell has been changed to zsh Catalina. So I went and followed the instructions on the support page and changed the default shell back to bash, which fixed the problem. I am not quite sure why this problem occurred initially since the Broken Pipe Error appeared before I updated to Catalina.
Anyways changing the default shell back to bash shell fixed everything

Unable to map path to postresql after installation of Postgres 9.3 to mac

After installing Postgresql by dragging folder into my applications folder I am unable to get commands to work in the terminal and unable to add the path so that is shows up using the command $ echo $PATH.
Postgres starts in the terminal using the elephant icon on the system tray and selecting "open psql" so I believe it installed correctly.
I tried adding all different combinations of the following lines to my .bash_profile
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
then
PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"
then
export PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin
and finally
export PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin
after each attempt I ran $ source $HOME/.bash_profile and then checked path and/or tried $psql $ which psql to no avail.
Also tried adding lines to .bashrc , .profile and .zshrc without luck.
The path to the executable commands bin folder in the app (psql, createdb, createlang, etc..) is
$ /Applications/Postgres93.app/Contents/MacOS/bin
Any help would be greatly appreciated!
running OSX 10.9.1
https://superuser.com/questions/707222/unable-to-get-postgresql-commands-to-work-in-terminal
answered at the link above by zelanix https://superuser.com/users/293259/zelanix

Resources