why does terminal start with '/Users/nicholas/.zshrc:source:75: no such file or directory:' after uninstalling ohmyzsh? - oh-my-zsh

i've uninstalled ohmyzsh and now everytime i start my termial it says this:
Last login: Sat Feb 6 13:53:16 on ttys001
/Users/nicholas/.zshrc:source:75: no such file or directory: /Users/nicholas/.oh-my-zsh/oh-my-zsh.sh
nicholas#macbook ~%
How to fix it?
(original screenshot here)

open .zshrc
If you can't find find .zshrc, then type "ls -a" in terminal to get hidden files
After opening .zshrc file, comment the line 75 by appending "#"

First you need to open the terminal on your mac.
Then type "ls -a" now you can see all .zsh files on your macOS
Delete .zsh file using this command "rm .zsh" then hit the enter.

move source $ZSH/oh-my-zsh.sh after the path variable. So it looks like below. save and reopen terminal.
export ZSH="/Users/<username>/.oh-my-zsh"
export PATH=$HOME/bin:/usr/local/bin:$ZSH:$PATH
source $ZSH/oh-my-zsh.sh

Related

How do I run some command every time the new terminal window is open in VS Code?

So I want to run source ~/.bashrc in VSCode terminal so I can load my own command to run on it. Right now I have to manually on the command line. Are there anyway I can run the command before the terminal start? (OS: Mac)
Since you are using macOS, the ~/.bashrc file is not used, instead it's ~/.bash_profile. You can do one of the following:
Put your custom commands in ~/.bash_profile, or
Source your ~/.bashrc from your ~/.bash_profile:
Create a file ~/.bash_profile with the following content:
source ~/.bashrc
Give the new file the same permissions as ~/.bashrc

Running .sh scripts in Git Bash

I'm on a Windows machine using Git 2.7.2.windows.1 with MinGW 64.
I have a script in C:/path/to/scripts/myScript.sh.
How do I execute this script from my Git Bash instance?
It was possible to add it to the .bashrc file and then just execute the entire bashrc file.
But I want to add the script to a separate file and execute it from there.
Let's say you have a script script.sh. To run it (using Git Bash), you do the following: [a] Add a "sh-bang" line on the first line (e.g. #!/bin/bash) and then [b]:
# Use ./ (or any valid dir spec):
./script.sh
Note: chmod +x does nothing to a script's executability on Git Bash. It won't hurt to run it, but it won't accomplish anything either.
#!/usr/bin/env sh
this is how git bash knows a file is executable. chmod a+x does nothing in gitbash. (Note: any "she-bang" will work, e.g. #!/bin/bash, etc.)
If you wish to execute a script file from the git bash prompt on Windows, just precede the script file with sh
sh my_awesome_script.sh
if you are on Linux or ubuntu write ./file_name.sh
and you are on windows just write sh before file name like that sh file_name.sh
For Linux -> ./filename.sh
For Windows -> sh file_name.sh
If your running export command in your bash script the above-given solution may not export anything even if it will run the script. As an alternative for that, you can run your script using
. script.sh
Now if you try to echo your var it will be shown. Check my the result on my git bash
(coffeeapp) user (master *) capstone
$ . setup.sh
done
(coffeeapp) user (master *) capstone
$ echo $ALGORITHMS
[RS256]
(coffeeapp) user (master *) capstone
$
Check more detail in this question
I had a similar problem, but I was getting an error message
cannot execute binary file
I discovered that the filename contained non-ASCII characters. When those were fixed, the script ran fine with ./script.sh.
Once you're in the directory, just run it as ./myScript.sh
If by any chance you've changed the default open for .sh files to a text editor like I had, you can just "bash .\yourscript.sh", provided you have git bash installed and in path.
I was having two .sh scripts to start and stop the digital ocean servers that I wanted to run from the Windows 10. What I did is:
downloaded "Git for Windows" (from https://git-scm.com/download/win).
installed Git
to execute the .sh script just double-clicked the script file it started the execution of the script.
Now to run the script each time I just double-click the script
#!/bin/bash at the top of the file automatically makes the .sh file executable.
I agree the chmod does not do anything but the above line solves the problem.
you can either give the entire path in gitbash to execute it or add it in the PATH variable
export PATH=$PATH:/path/to/the/script
then you an run it from anywhere

Mac Terminal /bin/settitle.sh: No such file or directory

I'm trying to create a bash script to change the titles of my terminal windows so I can identify what they are doing. I spent a few hours on this and cant figure it out. The idea is to be able to execute settitle NewTitle. Thank you.
This is my echo:$PATH. It looks like Users/klik/bin is there twice. Maybe that is the issue?
~ klik echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/klik/bin:/Users/klik/bin
This is the script which was created in textedit in plain text format.
#!/bin/bash
# settitle: set the Mac Terminal title
# usage: to set the titlebar to 'PLAY', type: settitle PLAY
echo -e "\033]0;${1}\007\c"
This is my bash_profile and bin file.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
export PATH=$PATH:$HOME/bin
alias desk='cd ~/Desktop/'
alias down='cd ~/Downloads/'
alias github='cd ~/github/'
This is my ls -a output
Current directories
~ klik ls -l $HOME/bin | pbcopy
total 8
-rwx--x--x# 1 klik staff 147 Mar 9 21:39 settitle.sh
Try this:
echo -e "\033]0;FreddyFrog\007\c"
You need to use -e to turn on interpretation of escape characters. You can also use printf.
printf '\033]0;%s\007\015' "Hippo Croco Horror Pig"
This issue above was that the file was saved with .txt extension. I dont know why this was the case given the ls command showed a .sh ext. At any rate, this is the process I used for creating this script and and executing it.
Open Finder -> Applications->TextEdit in Mac.
Select New Document at bottom left.
From menu select Format -> Make Plain Text
Paste in this code:
#!/bin/sh
# settitle: set the Mac Terminal title
# usage: to set the titlebar to 'PLAY', type: settitle PLAY
echo "\033]0;${1}\007\c"
Thanks to Alvin Alexander for the code.
Still in TextEdit select menu File -> Save
Uncheck "If no extension is provided, use ".txt" "
When I chose my file name I saved it with no extension so i could just type the command settitle NewTitle without having to type the extension every time.
Note the folder the file is being saved to. It defaults to desktop on my machine.
Open Finder -> Go -> Go to Folder
Type in the path to your User Bin folder: mine was /Users/klik/bin
You can check to see if you have a User/bin folder by running: ls -l from your home directory.
If you don't have a bin folder in this directory you can create one by going to your $HOME directory and executing:
mkdir bin
To find out what is your home directory see this
You can then open the directory by executing:
open bin
This will open the folder in Finder.
Drag the script file you created into this folder.
Make sure the script is executable by executing the following command from the folder the file is in or by including the path to the file in name of file:
chmod +x <name of file>
Make sure that the script is in your executable $PATH by executing:
echo $PATH
You will get something like this:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/<you>/bin
If you dont see the path of your script, ie /Users/''/bin, then the script file is not in your executable path and you need to put it in your .bash_profile. Execute ls -l to see if you have a .bash_profile file.
ls -l
If you don't have one, make sure your are in your $HOME directory then create one by executing:
mkdir .bash_profile
Open your .bash_profile file in your default editor:
open .bash_profile
Or open with nano (to save and close nano see this link):
nano .bash_profile
Add the following line to the .bash_profile then save/close:
export PATH=$PATH:$HOME/bin
Exit the terminal to reset by executing:
exit
Open the terminal then type:
settitle <whateveryouwant>
I hope this saves someone some time. Thanks to Mark Setchell for his constructive help.

Shell script invocation error - deleted Fabric framework remains in project

I've added Fabric/Crashlytics framework into my project manually (not via Cocoapods) before, and then deleted both manually too. This error showed up at the compile time:
/Users/myUserName/Library/Developer/Xcode/DerivedData/ProjectName-hgnmlcwlcxdbmqdzjjegfjbdmxsy/Build/Intermediates/ProjectName.build/Debug-iphonesimulator/ProjectName.build/Script-800A33631A8B53890076A7E8.sh: line 2: ./Fabric.framework/run: No such file or directory
I found the .sh file in the path and tried to delete it, but that file got generated automatically every time I run the project:
Please help me fix this hour burner...
Here's the entire error message if needed: dropbox link
This still happens in
[Crashlytics] Version 3.7.0 (102).
You have to change file permissions for both the script
chmod 755 ./YourApp/SDK/Fabric/Fabric.framework/run
and the executable
chmod 755 /YourApp/SDK/Fabric/Fabric.framework/uploadDSYM
If the script doesn't need to be executed (which I'm guessing since you tried to delete it). You can always try this workaround:
$ script="/Users/myUserName/Library/Developer/Xcode/DerivedData/ProjectName-hgnmlcwlcxdbmqdzjjegfjbdmxsy/Build/Intermediates/ProjectName.build/Debug-iphonesimulator/ProjectName.build/Script-800A33631A8B53890076A7E8.sh"
$ awk 'NR==2 { print "exit 0;" } { print }' "$script" > .tmp && mv .tmp "$script"
Which adds an exit between the first and second line of the script. If the file gets regenerated you can also work around that by changing permissions:
$ sudo chmod 111 "$script"
This way the file should be protected from being overwritten or re-created.
Hope this helps:
Step : 1 : open your path (/Users/myUserName/Library/Developer/Xcode/DerivedData/ProjectName-hgnmlcwlcxdbmq‌​dzjjegfjbdmxsy/Build/Intermediates/ProjectName.build/Debug-iphonesimulator/Projec‌​tName.build/Script-800A33631A8B53890076A7E8.sh) with go to folder from finder.
Step : 2 : There open your "Script-800A33631A8B53890076A7E8.sh" file
Step : 3 : Modify .sh file as shown below
#!/bin/sh
exit 0; chmod 111 //add this after building has started and save
./Fabric.framework/run <FABRIC API KEY> <FABRIC API SECRET>

getting "bash: /etc/profile [...] No such file or directory" message when starting up a new terminal window

Last login: Wed Feb 27 22:38:32 on ttys003
-bash: /etc/profile.d/rvm.sh: No such file or directory
-bash: /etc/profile.d/sm.sh: No such file or directory
Williams-MacBook-Pro:~ william$
I think this has something to do with an rvm-installation going wrong sometime in the past, but I can't seem to fix the error that shows up everytime i open up a new terminal window.
The solution was to cd to /etc/profile and comment out the two lines that was causing trouble.
The solution for me was to cd to /etc and to modify the profile file.
The previous answer to cd /etc/profile didn't work as on my Mac, "profile" is a file and not a directory.