git-crypt path on MacOSX - macos

I have installed git-crypt (https://github.com/shadowhand/git-encrypt) on Windows and it's work fine.
But when i try on MacOSX (Mavericks), it's not successful.
From the guide this command on Linux:
$ sudo ln -s "$(pwd)/gitcrypt" /usr/local/bin/gitcrypt
But i can not make it work on MacOSX.
I also try this command without success:
sudo -s 'echo "/usr/local/bin/gitcrypt" > /etc/paths.d/$(pwd)/gitcrypt'

I have found solution. I post here for anyone find it:
$ clone https://github.com/shadowhand/git-encrypt /usr/local/git-encrypt
$ sudo vi /etc/paths
Add /usr/local/git-encrypt to the end save and quit terminal.

Related

source /.bash_profile command provide error

I run the command source ~/.bash_profile and get the following error:
$ source ~/.bash_profile
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: syntax error near unexpected token `<'
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: ` done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")'
The login shell that I use is bin/sh:
Whats the issue here and how to solve it?
This is how I solved the issue with the provided steps:
Install Homebrew from the docs on their homepage
Install Git using Homebrew (optional, but nice to have a more up-to-date git)
brew install git
Now install bash:
brew install bash
Add this install of bash to the allowed shells list:
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
Homebrew installs things to /usr/local/Cellar/ by default, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash
Finally, change your shell to use this new one:
chsh -s /usr/local/bin/bash
Open a new terminal window/tab, and run these commands to double-check your work:
$ echo $SHELL
/usr/local/bin/bash
$ echo $BASH_VERSION
5.1.8(1)-release
This also solved the issue for running the source ~/.bash_profile whenever I open a new window in the terminal.
Reference:
The answer is from here How do I install Bash >= 3.2.25 on Mac OS X 10.5.8? by user jeffbyrnes

Can't find nix-env or nix-build on MacOS Catalina

I can't find nix-env, nix-build, nix-shell etc. on MacOS Catalina.
I installed with:
sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
and was able to run them yesterday. I restarted my computer and can no longer find them. find / -name nix-env | grep nix-env shows nothing.
I tried installing again with the same command (sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume) but this time it exists immediately with 0 status code.
I suspect I need to do something to mount a virtual drive.
You should follow Notes on the recommended approach.
It looks like the volume is not mounted (check /etc/fstab state with vifs as described in documentation).
Use the Disk Utility UI to remove the nix volume (sudo rm -rf /nix won't work).
Then run the script again and cross fingers your fingers this time: sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
While Nix (amongst others) installs with bash newer MacOS do use zsh instead of bash.
So you need to update your .zshrc to source this command from bash, too.
In your terminal start editing with:
sudo nano ~/.zshrc
and add:
source ~/.nix-profile/etc/profile.d/nix.sh
Reload and test with
source ~/.zshrc; nix --version

How to add bash command completion for Docker on Mac OS X?

I am running docker and I want bash command completion for docker commands and parameters.
If you have already homebrew bash-completion installed just install the docker completion script into the bash_completion.d
curl -XGET https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker > $(brew --prefix)/etc/bash_completion.d/docker
Note: If you do not have homebrew bash-completion installed, follow these instructions to install it before you execute the line above.
Note: the completion depends on some functions defined in debian bash-completion. Therefore, just sourcing the docker completion script as described in completion/bash/docker may not work. If you try to complete docker run (by hitting TAB) you may get an error like __ltrim_colon_completions: command not found. This could mean that you have not installed the bash-completion scripts.
The official Docker for Mac page has a section on installing bash completion:
https://docs.docker.com/docker-for-mac/#bash
If you have Homebrew bash completion installed:
cd /usr/local/etc/bash_completion.d
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion
The completion scripts come with Docker Beta. I want them to stay up to date. So, on OS X...
Install homebrew's bash-completion
Symlink the files
find /Applications/Docker.app \
-type f -name "*.bash-completion" \
-exec ln -s "{}" "$(brew --prefix)/etc/bash_completion.d/" \;
The stumbling point for me was that once you brew install bash-competion, you have to add few lines in your .bash_profile to load it once you launch Terminal:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
Source:
http://davidalger.com/development/bash-completion-on-os-x-with-brew/
Because I haven't found anywhere a step by step documentation, I've made a quick script to install homebrew, bash-completion and eventually the completion scripts for docker.
https://github.com/HypnoTheNomad/docker-bash-completion-macos-brew
The auto completion of docker needed not only for mac, its also needed for ubuntu / bash terminals.
In Ubuntu
curl -ksSL https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker |sudo tee /etc/bash_completion.d/docker
Completion will be available upon next login.
Since its top result in google I added answer here.
The official Docker site has a section for Command-line completion, and for Mac to:
https://docs.docker.com/compose/completion/#mac
Helped for me with Homebrew:
brew install bash-completion
After the installation, Brew displays the installation path. From documentation is correct for me:
/usr/local/etc/bash_completion.d/
Run the script:
sudo curl -L https://raw.githubusercontent.com/docker/compose/1.25.4/contrib/completion/bash/docker-compose -o /usr/local/etc/bash_completion.d/docker-compose
Open and add following in the end of your file ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
Restart terminal. It's all.
Guide to setup autocomplete for ZSH on Mac OSX
Follow these steps if you are using oh-my-zsh and autocomplete is not working:
Step 1:
Make the following three links:
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.zsh-completion /usr/local/share/zsh/site-functions/_docker
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.zsh-completion /usr/local/share/zsh/site-functions/_docker-compose
Step 2:
Either add autoload -Uz compinit; compinit to .zshrc
or run echo "autoload -Uz compinit; compinit" >> .zshrc in your shell
Just to be said:
if you use brew:
brew install docker
will do all what you need. It includes brew link docker which installs the completion into `brew --prefix`/etc/bash_completion.d/docker
same topic, same answer for docker-machine, docker-compose, etc. ...
else (perhaps you are using Docker Beta (new "more native" docker installation package without Virtualbox) you still have to add it manually, then follow Michael's answer plus have a look at the additional completion scripts for docker-machine, docker-compose and some shell-helper that are handled in the 'script' from CodeCorrupt

OSX Uninstall via terminal a cUrl Installation

I've installed clamp thru this:
$ curl http://jide.github.io/clamp/install.sh | sh
( Followed this instructions: https://jide.github.io/clamp/ )
Now I have it installed, I found out is not working and is not exactly what I wanted, so I want to uninstall it. How do I do it?
If you look at the code, it has not done much but created /usr/local/clamp/ and then soft-linked /usr/local/clamp/clamp to /usr/local/bin/clamp.
Please refer the Line #64 & #65 of install.sh
You can delete the files as part of manual uninstall
$ rm -rf /usr/local/clamp/
$ rm -rf /usr/local/bin/clamp

PostgreSQL: command not found

I installed PostgreSQL via MacPorts. However, going to /opt/local/lib/postgresql84/bin I am unable to execute any of the pg commands. Does anyone know what I am doing wrong?
When you say "going to", it sounds like you're using the cd command to change to that directory. Something like:
$ cd /opt/local/lib/postgresql84/bin
$ psql
psql: command not found
Normally on Unix systems, the current directory is not part of your executable search path. So either explicitly execute psql from the current directory using ./:
$ cd /opt/local/lib/postgresql84/bin
$ ./psql
or, add the directory to your PATH:
$ export PATH=/opt/local/lib/postgresql84/bin:$PATH
$ psql
I had installed postgres (Mac,The capitan SO) with the dmg and also I got the same issue. I had to install psql through brew. Try with this :
brew install postgres
This worked for me.
Try this command:
find / -name psql
Try
whereis psql

Resources