How to set up packer PATH on Mac Unix - macos

The documentation of packer says: Packer Setup Documentation
on how to set the PATH : How to permanently set PATH in Unix
And I did add :
export PATH=$PATH:~/packer/
in my ~/.zshrc file
however, when I go to type packer on the terminal first time, the dir changes to be ~/packer and when I type packer again I get :
~ packer
➜ packer packer
zsh: command not found: packer
Does anyone have a better clue on how to set up packer's PATH on a Macintosh Unix system?

In OS X you would typically have any exports set in:
~/.bash_profile
If you already have a .bash_profile setup then it will override .profile. Since you're using zsh you might try putting the export in ~/.zprofile.

Please try adding your edits to the ~/.profile file instead of ~/.bashrc file.

To make the new path stick permanently you need to create a .bash_profile file in your home directory and set the path there.
Open terminal on Mac and write nano .bash_profile.
Create the .bash_profile file with a command line editor called nano,If it is already exists then it will open a text editor containing path.
Add the path you require like:
export PATH="/usr/local/node/bin:$PATH"
Save the file in nano by clicking Ctrl+O and confirming the name of the file as .bash_profile by hitting enter. And the Ctrl+X to exit nano.
Then for checking path is set or not just write echo $PATH in terminal. Your path would be there in it.

Related

How can I edit bash_profile if open command does not work and hidden file does not open in mac

I tried to change something in my bash_profile but I think I mistyped something. So I can not run any terminal commands. If I post "ls" command then I get
-bash: ls: command not found
Now I can not open bash_profile also. So what can I do here. I get the below path using echo command but there was some any other path. Please help.
echo $PATH: /usr/local/bin:/usr/local/bin:
But if I write /bin/ls it works.
MacBook Pro El Capitan : 10.11.4
This is the possible answer - And I solved it using nano editor
You messed up your PATH environment variable.
/bin/ls
works because you did not need PATH to find the 'ls' program. You can run ANY command by specifying its full path.
You need to re-edit your .bash_profile to either remove your PATH, or fix it. I do not know what editor you used to modify .bash_profile to begin with, but you can use
/usr/bin/nano
/usr/bin/vi (ONLY if you know vi/Vim)
/usr/bin/vim (ONLY if you know vi/Vim)
/usr/bin/emacs (I shutter to think about this)
TextWrangler (a very good free GUI text editor)
http://www.barebones.com/products/textwrangler/
Or you can just rename the current .bash_profile and start a new terminal session, then fix the renamed .bash_profile before putting it back in service
/bin/mv .bash_profile saved.bash_profile

Local .bashrc is not read on startup under MobaXterm Home on Windows

I am using MobaXTerm (Home version 3.0). I have create a direcorty C:\MobaXterm_3.0\home and set in the local configuration (Settings --> Configuration) the home directory to this path. Under this path I have created a .bashrc file with read access for everybody.
However when starting up MobaXterm, the .bashrc file does not get executed. How can I fix this? The MobaXterm docu says that in the Home addition I cannot change the /etc/profile, but the standard /etc/profile does execute ~/.bashrc. So I am a bit at a loss.
ps: I am aware of the answer to "How does one define aliases for use within MobaXTerm local bash shell?" and have created the .bashrc file with the right permissions.
When you launch a local terminal in MobaXterm first time .bash_profile is executed which sets up the required configuration for the initial shell command prompt to work. The idea is to source the .bashrc from the .bash_profile.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
Add the above lines to your .bash_profile.
Source: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

How to install Dart to be used in the terminal? (command line)

How do you install Dart so the language can be used within the terminal? (For UNIX based systems, such as a Mac)
After installing Dart (currently located at https://www.dartlang.org/), you will need to do some additional work to use dart commands in the terminal (command line), as it needs to be added to the Bash profile PATHs (on a UNIX based system). To do this, run the following handy command to open the .bash_profile file in it’s default location and with the system’s default text editor touch ~/.bash_profile; open ~/.bash_profile.
Next find the directory that Dart was downloaded to and put the path for dart-sdk/bin inside the .bash_profile as apart of the PATH variable. I.e. a line of code should be added to this file that looks something like this (if you’ve put the dart install in the applications folder on a Mac): export PATH=$PATH:/Applications/Dart/dart-sdk/bin.
To get Bash to start using this new profile immediately without restart, enter source ~/.bash_profile in the terminal (command line), then to double check the PATHs have updated, by enter in the command echo $PATH.
1) Install Dart in your environment (if have not yet)
https://www.dartlang.org/tools/sdk#install
2) Add PATH variable for dart/bin
Example for Ubuntu
# add path example
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.bashrc
source .bashrc
or it can be .bash_profile instead of .bashrc
3) And now just run your .dart file with the main() method in the terminal and see an output
$ dart path_to_your_file/your_file_with_main.dart

How to add a directory to PATH in the file .bashrc?

After installing python(EPDFee), I want to add the /bin directory to $PATH variable. I am use bash shell. I have found that I have to add the following line in the file .bashrc
export PATH=/home/usrname/epd/bin:$PATH
I have found the file .bashrc, it reads
PATH=$PATH:/opt/bin
# Added by Canopy installer on 2014-03-29
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /home/an/Enthought/Canopy_64bit/User/bin/activate
Could you please tell me where can I add export PATH=/home/usrname/epd/bin:$PATH to or is should be added in another file?
add the following line to your .bashrc file ...don't forget to replace your path.
export PATH="/path/directory:$PATH"
then do
source .bashrc
to let the changes make effects. I am not sure about other distributions of Linux but It will work on CentOS and RedHat.
You can do it like this :
Define a EPD_HOME var and append it to PATH
EPD_HOME=/home/usrname/epd/bin
PATH=$PATH:$EPD_HOME:$HOME/bin
export PATH
Notice that the $EPD_HOME variable is in the PATH variable and is now loaded once you open a connection to your user on the machine.

Shell shortcuts to folders in Windows

I'm learning Vagrant and Virtualbox, Now to add a line to my hosts file in a (windows)
echo "test" >> c:/windows/system32/drivers/etc/hosts
But i'm wondering if i can make a Shortcut to c:/windows/system32/drivers/etc/hosts that i can use in any shell from everywhere.
You might create an environment variable:
[System.Environment]::SetEnvironmentVariable('Youralias','c:/windows/system32/drivers/etc/hosts','Machine)
and then access it using
$env:YourAlias
from PowerShell... If you want to access it from CMD
%Youralias%
should work.
Easier solution using a .bash_profile file
In your home folder (windows) you can make a .bash_profile file and specify aliases.
Go to your home folder
cd ~
make a .bash_profile file and open it in vim or any other editor
touch .bash_profile && vim .bash_profile
add a new alias by adding the following line
alias testfolder="cd /c/testfolder"
save and close your editor.
Explanation someone?
For some reason it only works after i run the following command
source .bash_profile

Resources