/bin/sh: osascript: command not found - macos

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 ;)

Related

zsh: command not found on MacOS Monterey

I wanted to create a react project and when I executed the command it said zsh: command not found: npx
Then I tried the ls command and it said zsh: command not found: ls.
After setting the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command both the ls and npx create-react-app command worked fine and when close the terminal and reopen again, the same command not found error shows.
Is there any permenent fix without setting export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command
For adding the variables to the path you need to add it to zshrc file for making that variable available locally.
The way you have used will only work until you use it in the same terminal window path only.
To solve the problem, follow these steps:
Goto you home directory
Simultaneously press cmd + shift + (.) Note:the last key is the key of dot
On following step 2, new hidden files will appear in home directory, look for (.zshrc) file and open it using any text editor.
Add your path variable in it, save and then close it.
Example: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Open terminal and run the command: "echo $PATH" and see if your added variable is present in the output shown by terminal.
If yes, You are now ready to go to use it from anywhere in terminal now.
This is what worked for me on macOS Monterey,
Although I added the path to ./zshrc and sourced the file, after reopening the terminal the PATH was not exported
I followed these steps to solve this
Created .zprofile with touch .zprofile at the home directory. If the file already exists use that.
Add the required path to this file using vim or nano
eg: export PATH=${PATH}:/Users/Development/HashBaze/flutter/bin
If the above two steps don't work try sourcing both the .zprofile and .zshrc after following the above two steps.
This solution worked for me on macOS Monterey version 12.5

Ubuntu Terminal showing bash: /home/vostro/.rvm/scripts/rvm: No such file or directory on Launch

In Ubuntu, whenever I launch terminal, on top Terminal shows a message
bash: /home/vostro/.rvm/scripts/rvm: No such file or directory
after that I can enter commands, how to fix it?
Check your .bash_profile or .bashrc file for any startup scripts that may have gotten added by RVM and you probably need to remove or comment out those lines.

no such file or directory at share folder

When I start bash, the following description appears:
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
i'm using Microsoft-Windows-Subsystem-Linux, with ubuntu distro.
I already tried uninstalling by powershell pip uninstall virtualenvwrapper or in bash sudo pip uninstall virtualenvwrapper.
I also entered the share directory to delete the virtualenvwrapper folder, but it does not appear. I'm pressing LS and the folder does not appear.
I am also trying "which virtualenvwrapper" or "which virtualenvwrapper_lazy.sh" but this simply returns the same folder as I am.
i just need help to remove that message of bash
Most likely, there is a reference (potentially with source or .) to virtualenvwrapper_lazy.sh in one of bash startup files. Look at the usual suspects: ~/.bashrc, ~/.profile, /etc/profile, /etc/bash.bash.rc, /etc/.bash_login
To help with debugging, consider getting by adding set -x to ~/.bashrc, or by running interactive session
bash -ix /dev/null
UPDATE, based on log:
Per https://superuser.com/questions/893448/bash-shell-error-no-such-file-or-directory/1049989
I just had the same problem on Linux Mint.
The following file was causing the issue:
/etc/bash_completion.d/virtualenvwrapper
I made a backup (just in case) and deleted it, and everything seems to
be working fine now.

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.

sudo: ./install.sh: command not found is not working on Lion

I've been following this tutorial in order to get SimpleOpenNI installed on my mac but I keep getting stuck at installing the OpenNI and NITE components because it requires me to navigate to the folders in Terminal and then run "sudo ./install.sh". I do this and I get this error:
sudo: ./install.sh: command not found
I've installed Command Line Tools in Xcode and everything.
Thanks
The reason why that happens is because the script you are trying to execute needs the right permissions.
Type:
sudo chmod a+x install.sh
and then try again.
In directory of install.sh
prompt$ sh install.sh
first open Terminal, type cd and than drag the map into Terminal and press enter. Now type sudo ./install.sh and it will work. Took me very long to find out. Hope it helps.
.sh scripts should have "\n" line breaks.
"Command not found" also occurs if "\r\n" line breaks are used.
Well at least this is the case on FreeBSD.
You need to run VBoxLinuxAdditions.run as root, not autorun.sh
Once you've inserted the Guest Additions ISO, open Files and open the disc from the sidebar. Then, right-click in the background of the window where autorun.sh is and select
Open in > Terminal
Now you can run the following command to install the Guest Additions:
sudo ./VboxLinuxAdditions.run
I'm a newbie but here is an answer that may help with the sh problem...I am running Armbian on an orange pi prime H5 SBC and I had downloaded and unzipped arduino ide well after 2 hours of searching and trying I hit it ....open the directory where the file you want to open or install is ...now at the top of the directory open a terminal(under file it will say open a terminal here).now the sh filename.sh will work.

Resources