Brew Doctor changing directories - terminal

I'm very new to this and I'm currently installing all the needed programs that I need for my online courses.
I've come to homebrew / brew doctor now and whenever I try to type "brew doctor" into the terminal I get the following:
Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
./
I've tried looking around but this is the first I've seen where there's not a specific directory mentioned, only * ./*
How do I fix this?
Edit:
$ echo $PATH
/Users/ME/.rbenv/bin:/usr/local/bin:/usr/bin:/sbin:/usr/local/sbin:usr/local/bin‌​:/usr/local/mysql/bin:./:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bi‌​n
Edit 2: And how do I edit my login profile? I'm sorry if this is extremely obvious, but I am extremely new at this.
Edit 3:
$HOME/.profile -bash: /Users/ME/.profile: No such file or directory
Edit 4: grep PATH ~/.bash_profile gives:
export PATH="$HOME/.rbenv/bin:/usr/local/bin:/usr/bin:/sbin:/usr/local/sbin:usr/local/bin:/usr/local/mysql/bin:./:$PATH"
Edit 5: Thanks for pointing out the error, greatly appreciated. How do I remove that from my PATH?
Edit 6, hopefully last. Thank you all so far: typed in: $HOME/.bash_profile
-bash: /Users/ME/.bash_profile: Permission denied

Related

Error on terminal open: -bash: /nvm.sh: No such file or directory

Every time I open my terminal the first line says: -bash: /nvm.sh: No such file or directory.
I just installed nvm on this laptop and obviously I did something wrong.
Does anyone know what commands I can use to fix this?
I tried the following command to remove nvm from my laptop:
$ rm -rf ~/.nvm
Sadly, this did not fix my problem.
Check your .bashrc file (usually in the home folder). See answers to this question. There's probably a line reading /nvm.sh somewhere in there -- if so, just delete it.
As Gasper Stukelj awnsered:
There was a line reading /nvm.sh.
The correct path to the file was for me using macOS Mojave:
$ open ~/.bash_profile
In my case I fixed this problem, just putting in terminal, after installing nvm: export NVM_DIR="$HOME/.nvm" and [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
and after that I installed node normally
How did I find this solution?
Simple, I read the terminal, and it gave two ways to solve. The first option was for me to restart the computer, to see if the changes (installation) took effect, and the second option was for me to put these two commands in the terminal and only : )
Ready to use in my case :)
I used Google Translate
For me the issue was coming from the .bash_profile file. The line was:
source ~/.nvm/nvm.shexport PATH="/usr/local/opt/php#7.0/bin:$PATH"
I removed everything after nvm.she and the error isn't showing in the terminal anymore. This happened while trying to install xdebug on Mac Big Sur.
I failed to find a solution in Google searches, so I just installed nvm again to resolve the issue. I guess some files were not installed.
brew install nvm

/bin/sh: osascript: command not found

I am trying to run jupyter notebook through Anaconda in mac but it is showing :
-bash: touch: command not found
MacBook-Air:~ ajay$ /anaconda3/bin/jupyter_mac.command ; exit;
/anaconda3/bin/jupyter_mac.command: line 1: dirname: command not found
/anaconda3/bin/jupyter_mac.command: line 3: /jupyter-notebook: No such file or directory
logout
Saving session...-bash: date: command not found
-bash: touch: command not found
...copying shared history...-bash: cp: command not found
...saving history...-bash: cat: command not found
-bash: cat: command not found
truncating history files...
...completed.
-bash: find: command not found
-bash: shlock: command not found
[Process completed]
The content of jupyter_mac.command are :
DIR=$(dirname $0)
$DIR/jupyter-notebook
and when I run jupyter notebook in terminal it shows
/bin/sh: osascript: command not found
I also checked to see jupyterlab on Anaconda and it was working fine but jupyter notebook was not opening.
Few days ago, I installed mongodb on my mac and when I run echo $PATH it shows /anaconda3/bin:/usr/local/mongodb/bin:??
I, even, reinstalled anaconda and before reinstalling deleted its folder from the drive but it still giving the same problem.
Being a new mac user, I am not able to understand what is happening, so I gave the important details.
Your PATH tells the shell where to find programs. Yours is messed up, so it cannot find anything. It is probably set in $HOME/.profile so you need to open that file in your editor and look for export PATH=....
You probably want it set something like:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/anaconda3/bin:/usr/local/mongodb/bin
In future, where you add anything to your PATH, you need to carry forward whatever it was previously set to and append like this:
export PATH="$PATH":/some/new/directory
Once you have set your PATH correctly, start a new Terminal and run:
echo $PATH
in it to see if looks good.
If you did a fresh install of Anaconda on macOS Catalina, you can fix it with the following command:
export PATH=/opt/anaconda3/bin:$PATH
That worked for me, but in case this is not the correct path for you, you can run Jupiter notebook from the GUI of Anaconda navigator, and check on the terminal window that is opened automatically where is the anaconda3 folder. Then just add that to your path ;)

Torch / Lua after installation is not working

I have followed the following approach in order to install Torch in my machine (Mac).
http://torch.ch/docs/getting-started.html#_
When I am done with the installation, I type:
$ luarocks install image
or $ luarocks lis
or $th
in order to load the th or to make updates on the lua packages. It says "command not found". Do you have any idea how I can resolve this issue?
If you're on a Mac using the bash terminal, make sure that you've permanently added /Users/you/torch/install/bin to your PATH.
To do this:
Navigate in your terminal to the root directory by running the command:
$ cd
Using the text editor of your choice (emacs, vim, etc.) open the .bash_profile file for editing. For example:
$ emacs .bash_profile
Add the following line to the end of the file (replacing 'you' with your Mac username):
PATH=$PATH\:/Users/you/torch/install/bin ; export PATH
Save and exit the text editor
Source the changes by running:
$ source .bash_profile
Check that your PATH has been updated (look for /Users/you/torch/install/bin in the string returned):
$ echo $PATH
To make sure it has been changed permanently, completely quit Terminal, open it and run echo $PATH again
Now try th and it should run Torch!
For more help on PATH:
https://kb.iu.edu/d/acar
The Torch installation (at least for me) added the line . /Users/jb/torch/install/bin/torch-activate to my .profile file, not .bash_profile. I tried adding that exact line to .bash_profile but it didn't work, so based on the recommendations here I got rid of the trailing directory and such.
Have you updated your PATH? It should include something like
/home/user/torch/install/bin
I faced the same issue and following this post deleted and reinstalled everything. However in the end what helped was adding /home/user/torch/install/bin/ to the PATH variable.
I have resolved the issue. I have deleted torch and I have installed it again. I have updated my PATH, and I have ran the $ luarocks install image command. After all of these, I was able to ran $ th command and in general torch.

can't access .bash_profile

So I was adding a path to my bash profile, and I accidentally started it with 'myname 1' instead of 'myname1'. I think the space has messed something up.
When I open my terminal now, I get:
-bash: export: `1/Documents/android-sdk-macosx/platform-tools:/Users/XXXX/Library/PreferencePanes/MMPane.prefPane/Contents/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin': not a valid identifier
-bash: dirname: command not found
-bash: /Users/bin/git-prompt.sh: No such file or directory
I know the '1/ is super messed up, but now when I try to edit the profile again nothing works. I can't access it with nano or anything. I don't even think it can find my profile anymore.
Does anyone know how I can access that old profile to fix the edit I made?
It's likely that your PATH environment variable has now been set to myname, and so trying to run a command foo will now only work if an executable named myname/foo exists. The way around this is to give the absolute path of any program you want to execute. For example, nano most likely resides in your /usr/bin directory, and so you should be able to run it to edit your .bash_profile by typing:
/usr/bin/nano ~/.bash_profile
If that's not the correct path, other likely locations for nano include /usr/local/bin/nano and /usr/pkg/bin/nano; the correct answer depends on your operating system and distribution thereof.
Type the full path to the editor.
I assume the following will work:
/bin/vi .bash_profile

Fixing Homebrew Warning: Directory should not end in a slash

I installed Homebrew today, and as the application suggested, I ran
brew doctor
I got this warning:
Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
/Users/MyUsername/
After googling this, I opened
vi ~/.bash_profile
from terminal and manually removed the "/" after my username. So now my .bash_profile looks like this:
export PATH=$PATH:/Users/MyUsername
export PATH=/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/MyUsername
Then I retyped the prompt and got the same warning. How do I fix this?
Did you try restarting Terminal? Or at least opening a new session (tab)?
And if you're using zsh, you'll need to edit the ~/.zshrc file and remove the trailing slash on the end of "/usr/local/bin" as well.
After editing your profile, you have to tell the OS. From the terminal, execute the following command:
source ~/.bash_profile

Resources