Couldn't Create Link
Creating the link “/usr/bin/mate” failed with the following reason: Operation not permitted
I am getting this error when I attempt to link the terminal usage with TextMate.
I did this by going Help >> Terminal Usage...
And I tried to create a link in /usr/bin.
I think the problem is something to do with permission issue.
I am wondering if there is a way to work around this problem by changing bash file directly or something and make terminal recognize "mate" as a command.
Thank you for any suggestion.
Assuming Textmate is installed in /Applications the following command in the terminal should manually create the link for you:
$ sudo ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/bin
The command will ask you for your user account's password so it has the permissions necessary to create the link in /usr/bin/
There should be an option to create it in /usr/local/bin. Create it there. Make sure /usr/local/bin is in your $PATH.
Related
Description of Problem:
I'm trying to use terminator in a bash script but I keep getting an error stating that No such file or directory: ~/.config/terminator/config. and its keeping the terminals from popping up on screen. However when I run terminator on my terminal the window pops up. So I definitely have terminator installed I just don't know where terminator/config is.
Questions and summary of issue:
How would I check if terminator/config exists on my system?
Where would I find it since it isn't in ~/.config?
Why would this be happening?
Solutions that I know don't work and extra information
Uninstalling and reinstalling. I did it before I came to this site to ask.
These are the commands I used to install it the first time:
sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
I don't think I was at the home directory when I installed terminator if that matters.
How would I check if terminator/config exists on my system?
Either find the file using 'locate':
$ sudo apt install locate -y
$ sudo updatedb # this is to update the file database
$ locate config
Or even better, use stat:
$ stat ~/.config/terminator/config
Where would I find it since it isn't in ~/.config?
If the file does not exist, you cannot find it ofcourse.
Perhaps create the file yourself.
$ mkdir -p ~/.config/terminator/
$ touch ~/.config/terminator/config
Why would this be happening?
The systems provides an error message. Because it expects there to be file, which isn't.
Please read the documentation.
the config file is created automatically if you make same permanent changes.
start terminator
right click -> preferences
go to tab profiles -> sub tab colors
choose a different color profile e.g. "Solirized light" https://i.stack.imgur.com/QYFyp.png
close preferences and confirm the color of the terminator has
changed.
now the file "~/.config/terminator/config" has been created, containing the current user configuration.
I'm following link to set up openCV on my mac
https://jjyap.wordpress.com/2014/05/24/installing-opencv-2-4-9-on-mac-osx-with-python-support/
and got following permission denied
I'm quite new to mac command line and openCV. So please do not skip some explanation
yun-MacBook-Pro:~ sangwoneum$ cd /Library/Python/2.7/site-packages/
yun-MacBook-Pro:site-packages sangwoneum$
yun-MacBook-Pro:site-packages sangwoneum$
yun-MacBook-Pro:site-packages sangwoneum$ ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
ln: cv.py: Permission denied
I wouldn't put a symbolic link into /Library/.
This is much better solved setting your PYTHONPATH:
export PYTHONPATH=/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/
This will work only in your current session though, so let's make that setting permanent:
Open up your .bashrc in your home directory with your favourite text editor (TextEdit can work, but be sure to use plain text (cmd-shift-T).
At the end of the file:
export PYTHONPATH=${PYTHONPATH}:/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/
(it's a bit different than above, in case there is already a PYTHONPATH defined).
Save, exit and source the file:
source $HOME/.bashrc
If you open up a new Terminal session/window/tab, this sourcing will happen automatically, and your path is correct.
Note that this solution only works if you're running Python from the command line. If you run it in another way, it may or may not work, and you might have to find another way to set your PYTHONPATH.
Sometimes when I create a file using vim some/path/newfile, vim lets me edit it, only to complain when I attempt to save my changes.
E212 Can't open file for writing.
This appears to happen only when the new file is located in a system directory.
:w! does not override this error.
How can I write the current buffer, without having to save it to a temporary location, exit, then rename it using sudo?
This will ask you for the root password, then save your changes as you requested:
:w !sudo tee %
Then type (L)oad at the prompt, to re-load the file after it is saved.
You can mkdir first, then save it.
Add this line to your .vimrc:
cmap w!! %!sudo tee > /dev/null
and then you can do
:w!!
when you get into this position, and it will write the file using sudo. Very handy.
You can avoid this problem by using "sudo" to start the editing session.
sudo vi name-of-file
If you want a robust, easy-to-remember solution and don't mind installing a plugin, try SudoEdit.vim - Edit Files using sudo or su or any other tool.
If this is the case in Windows 7 or later editions, run the VI editor as Administrator. Right Click of the application and select "Run as Administrator". This issue will be resolved. Moreover, the error is due to Administrative Privileges.
vim some/path/newfile
you can try to do it in two steps,first create the folder 'some' and 'path' by use mkdir ~ ;second you go into the 'path' folder,use the command:sudo vim newfile.then save it
Make sure the directory where you are trying to save the file exists and that you have permission to edit the file.
You can type :help message in Vim to get more information on this and other error messages. Try searching by typing /E212 once the docs come up. You can also view the documentation online at http://vimdoc.sourceforge.net/htmldoc/message.html and CTRL-F to find it.
For what it's worth, you may also want to ensure you have sufficient storage in the partition where you're attempting to save the file. I had to free up some space in my /home drive and that resolved the issue.
I know this is an old question, but this is what fixed it for me. Your file might be set to immutable meaning that you can't edit it.
You can check this with lsattr /path/to/file.txt
If it is use
chattr -i /etc/resolv.conf to make it no longer immutable.
Just had this issue outside of system directory.
When I tried to open a file vim src/help/tips.c. Turns out help directory did not exist, the directory was named differently and it was one of those very rare occasions that I did not auto-complete with Tab.
So, in conclusion, if this happens for a file that is not at a place where you may have permission issues, look if the path leading up to the file is a valid one.
I have experienced this in Kali!! The default account requires escalation to root with "sudo" in order for the file to be editable.
e.g: sudo vim / at this point all standard expectations appear to follow.
I'm currently going through http://ruby.railstutorial.org/ and it uses the command "mate" to access Textmate through the terminal. I have had Textmate on my Macbook Air (Lion OS) since I first bought it, but when I try to use a command like "mate .gitignore" the terminal gives me "mate: command not found".
I've looked through all other StackOverflow questions regarding this topic and have done the following:
Attempted to create a symbolic link through the terminal with this code.
$ sudo ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/bin
This code lets me enter my password and tells me the file exists, but still does not allow me to use the "mate" command.
Accessed Textmate/Help/Terminal Usage and tried to create a link for /usr/bin only for it to say operation not permitted.
Used alias mate='open -a textmate'. This works; however, I have to do it every time I open Terminal.
So, my question is can anyone tell me what is wrong? Love to figure this out!
Thank you!
First, you should not add anything to /usr/bin. You should add it into /usr/local/bin. Further, getting the message "file already exists" from ln means that it did not create the link. Try this:
ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/local/bin/mate
Depending on your current setup, this may have to be run with sudo. In general, if you don't know whether to run something with sudo or not, try without first and see if you get a permissions error, then use sudo.
The best way to do it is from TextMate -> preferences -> Terminal and then check install
all the previous methods didn't work for me.
After searching online, the best solution I've found so far is to just make a symbolic link in either "/Library/logs/" or "~/Library/logs/" to get it to show up in the Console application.
I'm wondering if it would be possible to add a new directory or log file to the "root" level directly under the "LOG FILES" section in the console.
Here's a quick screenshot:
There is one way to get your log files into the console.
You can add a symlink to the log file or log directory to one of the directories in the list. The directory ~/Library/Logs seems like the logical choice for adding your own log files.
For myself I wanted easy access to apache2 logs. I installed apache2 using macports and the default log file is located at /opt/local/apache2/logs.
Thus all I did was create the symlink to that directory.
# cd ~/Library/Logs
# ln -s /opt/local/apache2/logs/ apache2
Now I can easily use the console.app to get to the logs.
My solution for macOS Sierra:
First and last step, you must create a hard link from your source (log) directory into (as example) one of existing official log directories, you can seen in console.app.
I take my ~/Library/Logs directory for that.
hln /usr/local/var/log /Users/dierk/Library/Logs/_usr_local_var_log
Cross-posting this great tool for creating hardlinks originally posted by Sam.
Short intro:
To install Hardlink, ensure you've installed homebrew, then run:
brew install hardlink-osx
Once installed, create a hard link with:
hln [source] [destination]
I actually just came across this option that worked perfectly for me:
Actually if you open terminal and...
$ cd /Library/Logs
then sym-link to your new log directory. eg i want my chroot'ed apache logs as 'www'
$ ln -s /chroot/apache/private/var/log www
then re-open Console.app
drill down into /Library/Logs and you will find your sym-linked directory.
;-)
Mohclips.
http://forums.macosxhints.com/showthread.php?t=35680
In Terminal run this command... append any log file directories you want to add
defaults write com.apple.Console LogFolderPaths -array '~/Library/Logs/' '/Library/Logs/' '/var/log/' '/opt/local/var/log/'
Since Mavericks, symlink behavior as change so "ln - s" doesn't work anymore.
use hardlink-osx instead to create an hardlink to your directory (may be installed via homebrew)
Very old post I know but, this is the only way I could get it to work.
cd /Library/Logs
sudo mkdir log_files
sudo ln -s /Users/USERNAME/Sites/website/logs/* log_files
In mac os 10.11, you may not be able to link to folder of logs, but instead you need to link to each log of logs folder in side console.
ln -s /opt/local/apache2/logs/error_log ~/Library/Logs/Apache2/error_log
You can just open any text file with console.app and it will add and keep it. Folder's though, no luck on that yet.
I was able to hardlink the files into ~/Library/logs by running:
ln /usr/local/var/logs/postgres.log ~/Library/logs
Notice the absence of -s.
No luck for directories though.
OSX Sierra 10.12.6
Just tried to do something similar.
I enter this in terminal, while the Console.app was running.
sudo mkdir -p /usr/local/var/log/apache2
sudo mv /private/var/log/apache2 /usr/local/var/log/apache2/apache2-old
sudo ln -s /usr/local/var/log/apache2 /private/var/log/apache2
Now whenever I open the Console.app it crashes.
Really wish there was a way of adding log files in the files. You CAN do it by dragging and dropping a folder onto the Console.app (given it a directory path as an argument), but the added folder only displays its immediate contents and doesn't allow for recursively descending into folders.
---------EDIT BELOW----------
Nevermind I stupidly did something like this leading to infinite recursion in Console.app
sudo mkdir -p /usr/local/var/log/apache2
sudo ln -s /private/var/log/apache2/apache2 /usr/local/var/log/apache2
sudo mv /private/var/log/apache2 /usr/local/var/log/apache2/apache2-old
sudo ln -s /usr/local/var/log/apache2 /private/var/log/apache2
I don't believe it's possible.
If you're generating log files, you should generate them into one of the standard locations anyway, so this won't be an issue.