Custom shell script can't be found I am running MacOSX Sierra and have homebrew installed. So I'm trying to create compress-slide.sh script under ~/bin. In order for me to get rid of doing symlinks I added the ~/bin in my path so my path looks like this now: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/bin

I've set the path under /etc/paths and here is how it looks like:

/usr/local/bin
/usr/bin
/bin
/usr/local/sbin
/usr/sbin
/sbin
~/bin


But when I try which compress-slide.sh nothing is found, it doesn't give me the path I'm expecting which is ~/bin/compress-slide.sh I just wish to use this script when I'm on different directories. Also I made sure that I'm the owner of the script and that it has executable permission.

-rwxr-xr-x  1 dummyuser  dummyuser   135B Dec 28 18:13 compress-slide.sh


Here's the content of my script, just a simple command to test it works;

#!/usr/bin/env bash

echo 'test'


Here is my homebrew config:

HOMEBREW_VERSION: 1.1.5
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9cd5a21b473f0271b162bbe7f77f7d1468c0cfa1
Last commit: 2 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 797542c1bf61c4cfc58c7a52a2534d154cc584d1
Core tap last commit: 8 days ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.10.1 =&gt; /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby =&gt; /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_60, 1.7.0_79
macOS: 10.12.2-x86_64
Xcode: 8.2.1
CLT: N/A
X11: N/A


Is this because of Homebrew conflicting with my setup? Has anyone encountered this as well?
I would sym link the scripts you place out of the path to /usr/local/bin so you don't need to reason with ~ expansion in .dot files for your shell.

It's possible to have a durable way to ensure your enviroment is set up to handle ~ - but I'm a fan of having absolute paths there to avoid problems when you su to other users and have environment cross contamination as well as issues like you face.

This isn't anything about homebrew - purely about bash or whatever shell you are using.