The idea is to have the environment configured like this:
mkdir ~/shortcuts cd shortcuts ln -s ../.. up2
As a result I want to be able to go 2 directories up the file tree whenever I call:
~/dev/project/src$ CDPATH=~/shortcuts cd -P up2 ~/dev$
I think I was able to achieve that on macOS a few weeks ago but I cannot remember how I did it (and now I'm not so sure about it any longer). Additionally, I'd like it to be portable (ideally, POSIX-compliant).