OSX: Custom Command Line Commands Not Working on Mavericks - macos

I'm trying to get Sublime Text 2 to work on command line. Since I upgraded to Mavericks I haven't had any luck.
$ echo $PATH
/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ ls -l /usr/local/bin/subl
lrwxr-xr-x 1 root wheel 62 Mar 13 13:38 /usr/local/bin/subl -> /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
$ subl htdocs/index.html
-bash: subl: command not found

Related

Some relative paths on macOS 10.15 Catalina beta (19A471t) do not work

There's an odd behaviour when using relative paths. For example:
$ cd /Users
$ ls -l ../bin
ls: ../bin: No such file or directory
$ ls -l /bin
-r-xr-xr-x 1 root wheel 623344 31 May 08:33 bash
-rwxr-xr-x 1 root wheel 36768 31 May 08:33 cat
...
But the following works fine:
$ cd /dev
$ ls -l ../bin
-r-xr-xr-x 1 root wheel 623344 31 May 08:33 bash
-rwxr-xr-x 1 root wheel 36768 31 May 08:33 cat
...
Some other directories do not return the No such file or directory message, but they act as if there was nothing there. For example:
$ cd /Users
$ ls -l ../dev
$
returns nothing, and back to the prompt. The following, however, works fine:
$ cd /bin
$ ls -l ../dev
crw------- 1 root wheel 19, 1 11 Jun 16:54 afsc_type5
crw------- 1 root wheel 10, 0 11 Jun 16:54 auditpipe
crw-r--r-- 1 root wheel 9, 3 11 Jun 16:54 auditsessions
...
I could not find anything on the release notes. The WWDC2019 session 710 (What's New in Apple File Systems) also does not mention anything.
I think it might be related to the new separation of directories into a read-only and a read-write volumes. But still, it should work.
I found this to be specially problematic when using npm link, which links to /usr/local/lib/node_modules/... but expressed as a relative path from the destination package. After linking I have to manually change the link from relative to absolute. An ugly hack that may have some unforeseen consequences.
Anybody any clues?
The issue has been resolved with in Catalina beta 4.

Sublime Text 3 - OS X Command Line, subl doesn't work

sI cannot make alias 'sublime' to work suing
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
I checked path:
/Applications/Sublime Text.app/Contents/SharedSupport/bin/
$ls- la
total 0
drwxr-xr-x 2 ks admin 68 Jan 19 11:22 .
drwxr-xr-x 3 ks admin 102 Dec 16 21:25 ..
This is what I tired to do:
open file using subl
$ cd subl
-bash: cd: subl: No such file or directory
$ open subl
The file /Applications/Sublime
Text.app/Contents/SharedSupport/bin/subl does not exist.
$ subl --help
-bash: subl: command not found
If it is still isn't working after you created the symlink, the file might be quarantined. To check, open a terminal and get yourself to the directory that subl is in. Once you are there, check the extended permissions by typing:
xatt subl
If you see com.apple.quarantine, your file is quarantined. To remove the quarantine do ...
xattr -d com.apple.quarantine my_jar.jar
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
Should do the trick. See this post for additional info Sublime Text 3 and Terminal prompt for OS X Mavericks?
few small things you can try
sudomkdir /usr/local
sudomkdir /usr/local/bin
sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sub
remember to change the sublime text version to that which you have installed ( I recommend 2/3, not the first one)
Usage in Terminal:
(for directory you're currently in) subl .
(any other directory) subl ~/Documents/example.txt
Try:
mkdir /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

Why cannot I call sublime Text editor 2 from terminal?

I tried this
Muhammeds-MacBook-Pro:first_app muhammedz786$ subl Gemfile
-bash: subl: command not found
Why is this happening?
I also tried this
Muhammeds-MacBook-Pro:first_app muhammedz786$ subl ~/.gemrc
-bash: subl: command not found
Please help
Run the following command from Terminal:
sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/bin/subl
and you should be able to use the subl command. If you are using Sublime Text 3, the command is
sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/subl

Mountain Lion, export $PATH to .bash_profile, permission denied?

I can do this:
sudo nano .bash_profile
But when I do this:
sudo echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
I get this error message:
-bash: /Users/mycomputer/.bash_profile: Permission denied
When I do ls -al:
-rw-r--r-- 1 root staff 27 10 Aug 12:22 .bash_profile
Quick fix: do "sudo bash", to actually assume root privileges, THEN do the echo. It will work. sudo echo still uses your real uid, so it fails.

How do I build SQLite3 from command line?

I'm kind of rusty at building software from the command line. whenever i've had to do it I just follow directions..so i don't have to tools to troubleshoot when something goes wrong...as it has today. I've run into a problem trying to build SQLite3 on a PowerPC Mac running OS X 10.5.8 (Leopard).
here are the "instructions" i'm following:
$ curl -O http://sqlite.org/sqlite-amalgamation-3.6.21.tar.gz
$ tar xzf sqlite-amalgamation-3.6.21.tar.gz
$ cd sqlite-3.6.421
$ ./configure –prefix=/usr/local
$ make
$ sudo make install
And here's what I'm doing...
$ pwd
/usr/local/src
$ curl -O http://sqlite.org/sqlite-amalgamation-3.7.3.zip
$ unzip sqlite-amalgamation-3.7.3.zip
$ ls -l
total 9096
-rw-r--r--# 1 elvis admin 82346 Oct 7 19:37 shell.c
-rw-r--r-- 1 elvis admin 1217170 Nov 20 11:47 sqlite-amalgamation-3_7_3.zip
-rw-r--r--# 1 elvis admin 4245940 Oct 7 19:36 sqlite3.c
-rw-r--r--# 1 elvis admin 3961 Oct 7 19:37 sqlite3.def
-rw-r--r--# 1 elvis admin 291339 Oct 7 19:37 sqlite3.h
-rw-r--r--# 1 elvis admin 20686 Oct 7 19:37 sqlite3ext.h
$ ./configure –prefix=/usr/local
-bash: ./configure: No such file or directory
Am I missing a configure file? Do I have the wrong source? I grabbed the zip version because I couldn't find the tarball (though admittedly didn't look too hard).
How do I build sqlite3 so it installs in /usr/local?
You must cd into the new in-tarred folder, then run ./configure. Also, use tar. It's better.
So: cd sqlit (hit tab)
./config...

Resources