Terminal search a file in a non-existent directory on MacOS - macos

I changed my Mac profile home directory. Today I needed to use composer in terminal. But the terminal gave this error(Could not open input file: /Users/old_home_directory/composer.phar). The problem only exists in zsh, in bash the composer command is executed. Changing the home directory to the previous version also does not solve the problem.

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

On each login --- startup or new terminal session --- a folder named `~` is created in my home folder

I am running OSX High Sierra with Homebrew.
Since yesterday, restarting the computer or creating a new login session - opening a terminal window, say - creates a ~-named folder in my home directory if it does not already exist.
I imagine there is a if (~ does not exist): mkdir /Users/me/~ type of call on creating a new session but are at a loss where to look.
I have checked logs via /Applications/Utilities/Console but have not found anything helpful yet.
Bash is my default shell. I also use the fish shell and the ~ folder is also created when starting a fish session.
The existence of the ~ folder within my home folder is causing issues with pyenv where calling pyenv versions displays only my system python, not any of the pyenv installed python versions nor any created virtual environments.
I have nothing in my .bash_profile nor .bashrc that would create these and so wish to find just what file is being read that creates the offending folder.
I had been playing around with for loops in the fish shell and a typo created the ~ folder in the home directory.
Expanding all EXPORT statements in my profile files (.bashrc, .bash_profile, .bash_alias) stopped this from reoccurring.
e.g. EXPORT PATH="~/bin:$PATH" to EXPORT PATH="/Users/me/bin:$PATH"
I could have also used EXPORT PATH="HOME/bin:$PATH"

How do I change the default start folder of jupyter-notebook?

I have installed anaconda on C:\Users\My_name\AppData\Local\Continuum\Anaconda2, the issue is that whenever I launch jupyternotebook or any other from the anaconda navigator the starting directory is a external network location Z:. I want jupyter to be installed and run on C:\ how do I solve it?
Here is a copy of the anaconda command prompt so you better understand what I mean.
I have already reinstalled anaconda making sure that I select the C:\ directory, even installing offline so the computer has no acces to Z:, but the result is the same. Any ideas on how to solve it?
I defined a new windows PATH variable to ~\Anaconda2\Scripts. Then I can start jupyter notebook anywhere just by tiping "jupyter notebook" on the command line.
For MacOS, edit this file:
/Users/{your user name}/anaconda/bin/jupyter_mac.command
Original was:
DIR=$(dirname $0)<br/>
$DIR/jupyter-notebook
I added a line:
DIR=$(dirname $0)<br/>
cd /Users/{your user name}/{whatever folder you want}/<br/>
$DIR/jupyter-notebook
This way, Jupyter notebook starts directory you want. Be careful about folder names with space. Use \ before the space. For example, the Google Drive folder shoule be:
cd /Users/{your user name}/Google\ Drive/

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

MacPorts Installation -- Shell Commands/Postflight Script

I had run the MacPorts installer (2.0.3) for my OS X Leopard (10.5.8) which finished "successfully". Unfortunately the port command was not available so I looked in the MacPorts Guide which says that the installer should have run a so-called "postflight" script that sets the necessary environment variables. I tried to run the postflight script manually (which I downloaded from here), but the execution fails with the following output:
Detected the bash shell.
Your shell already has the right PATH environment variable for use with
MacPorts!
Your shell already has the right MANPATH environment variable for use with
MacPorts!
Your shell already has the right DISPLAY environment variable for use with
MacPorts!
Adding [default] tag to sources.conf if needed...
couldn't read file "/Contents/Resources/upgrade_sources_conf_default.tcl": no
such file or directory
Updating port image format...
couldn't read file "/Contents/Resources/images_to_archives.tcl": no such file or
directory
Synchronizing the MacPorts installation with the project's rsync server...
-bash: __PREFIX__/bin/port: No such file or directory
An attempt to synchronize your recent MacPorts installation with the project's
rsync server failed!
Please run 'sudo port -d selfupdate' manually to find out the cause of the
error.
You have succesfully installed the MacPorts system, launch a terminal and try it
out!
Read the port(1) manual page and http://guide.macports.org for help,
http://www.macports.org/contact.php if you need to get in touch with The
MacPorts Project.
Any ideas?
First invoke the port command directly:
$ /opt/local/bin/port help
If that comes back with something reasonable (like the help text) then it's just that your $PATH isn't being used by your current shell. Try logging off and back on again to resolve that in the short term (this will test that your .bashrc file is correctly configured) or you could just modify the PATH environment variable directly (which doesn't test .bashrc):
$ export PATH=$PATH:/opt/local/bin
You downloaded the postflight script but it alone cannot access the accessory scripts in Contents/ because those are located into the install package.
Those missing Tcl scripts are for upgrading from an older install, the log says PATH was already correctly configured but the macports bin directory could have the wrong position in PATH variables, for instance being at the end of PATH.
If you are doing a fresh install you can just only need PATH and MANPATH -you want man pages provided by macports before system's ones- as per [1]
[1] http://guide.macports.org/#installing.shell.postflight

Resources