Make link to Application folder - macos

Sublime Text editor has in DMG file link to Applications dir (blue icons with arrow). It has small size.
How to make such link on my own folder? It must work in all Macs.

Open the terminal, use cd to open the folder where you want to create the symbolic link (this is how that kind of link is called, in case you want to research a bit more about it). Example:
cd /Users/MyUser/Desktop/
Note: In case the path has spaces, write it with backslashes before each space, like that:
cd /Users/MyUser/Desktop/My\ Folder/
Then, use that command to create it:
ln -s /Applications/ Applications
It will create a symbolic link which opens the path /Applications/, which means that it will work in any macOS computer.
Reference:
https://apple.stackexchange.com/a/115648

Related

WSL: Using A WSL symlink folder from Windows

I use WSL almost exclusively, and only switch to main windows for browsing and running Windows native programs. I have a git repository located at /mnt/c/myrepo. In order to "install" the code inside /mnt/c/myrepo I need to move it to /mnt/c/otherlocation/renamed. Instead of executing cp -r /mnt/c/myrepo /mnt/c/otherlocation/renamed every time I do a git pull from /mnt/c/myrepo, I would like to symlink /mnt/c/myrepo to /mnt/c/otherlocation/renamed. However when I do this, the program which consumes /mnt/c/otherlocation/renamed isn't able to view the "contents" of renamed as a directory.
I have been all over the WSL github repo and issue tracker trying to find a solution to this issue. I see a lot of exclamations about how symlinks "just work". I have enabled every Windows 10 developer feature I can find, I even followed some reddit thread where someone claimed that purchasing Pengwin and creating a symlink from Pengwin would ensure this compatibility, but I still can't seem to make this work.
The basic usage I need, is allow me to view "renamed" as a directory from windows, or for windows to recognize the symlink as a symlinked directory.
from wsl:
ln -s /mnt/c/myrepo /mnt/c/otherlocation/renamed
from windows:
open file explorer
navigate to c:\otherlocation
open mydir and view the contents as if it were a native directory
How do I do this?
Do the symlink in Windows, in cmd.exe:
mklink /d C:\otherlocation\renamed C:\myrepo
It doesn't make sense creating the symlinks in WSL if both directories are in Windows.
This symlink will work in WSL as well.
The solution to this problem is simply to use the relative path when declaring the link. If you want to link from windows to windows, you should relatively path from the current directory and then you can link anywhere you wish.
From the example, instead of this:
ln -s /mnt/c/myrepo /mnt/c/otherlocation/renamed
Do this:
cd /mnt/c/otherlocation
ln -s ../../myrepo ./renamed

Install .ttf font using command line

On OS X you can install .ttf font files by double clicking them. This is a hassle when dealing with multiple files. Is there a command to install font files using the Terminal app ?
You could copy the fonts using
cp myfont.ttf /Library/Fonts/
or multiple files
cp fontsFolder/*.ttf /Library/Fonts/
Install fonts with the following command line. Replace BRLNSR with your font and add in more lines if you need more fonts.
cd ~/Library/Fonts && { curl -O 'https://github.com/bloomberg/scatteract/raw/master/fonts/BRLNSR.TTF' ; cd -; }
This code does the following:
cd into the fonts directory
curl downloads the font
pops back to the original directory
This relies on the very nice bloomberg fonts github repo with a bunch of fonts stored - but you could change the curl url to wherever the font you want is located online.
The clever way the cd into a directory, download and pop out again came from user Atle's answer here.
To make the newly copied fonts available to applications requires activating them (for the process, for the user, or for the whole system). This you can do programmatically through various CoreText commands, depending on what you want to do with the font(s). I’m not sure if there’s a way to do this from the command line without turning on auto-activation for everything. See atsutil man pages for (scant) details.

How to get access to Google Drive from terminal

I am new to mac yosemite I have the list of my folder "Google Drive"
I can see this from ls -la command , but when I want to cd to it it said not exist ?
How can I actually get access to this drive via terminal ?
Arguments to commands in Bash (the language used in Terminal) are separated by spaces. So when you write cd Google Drive, you're passing two arguments to cd - Google and Drive. cd is just ignoring the second argument and trying to cd into the directory called Google, which doesn't exist.
In order to cd into Google Drive, you need to write cd Google\ Drive or cd "Google Drive". The \ escapes the space character and treats it as a single string.
For anyone looking for how to do this after Drive's recent updates... at the moment (June 2022) Drive files are stored in the following location:
/Users/_USERNAME_/Library/CloudStorage/_DRIVE_FOLDER_NAME_
If you are looking to access your files in a terminal window, the easiest way to get there may simply be to do the following:
Open a Finder window
If it's not already showing, go to the View menu and click "View Path Bar"
In the path bar (at the bottom of your Finder window), right-click on the home folder for your Google Drive account and click "Open in Terminal"
I would also type cd Goo and then press tabso it would autocomplete with the escaped space character.
In my case cd /Volumes/DATA/.CMVolumes/Google\ Drive/
As Google Drive has a space in between the words you need to quote the directory name.
Try cd 'Google Drive'
The cd Google\ Drive command seems to work for me.

How do I access my iCloud Drive folder from Terminal?

I'm running OS X Yosemite. I would like to save my code folder in iCloud Drive so that it's automatically backed up. I need to access files from the Terminal often, so how can I access iCloud Drive from the Terminal?
cd ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/
I would just add a symbolic link either to this folder or to a Source subfolder in your home directory to make working with this easier.
For example:
ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs ~/iCloud
and/or
ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/Source ~/Source
It´s in the Library Folder of the user. The folder-name is "MobileDocuments".
It's in ~/Library/Mobile\ Documents/com\~apple\~QuickTimePlayerX/Documents/....
How to find it? You can drag a file in the finder and drop the file to the terminal, then the file path would be displayed in the terminal.
This is an awful way to get the path, I'm very curious about how to reveal it more naturally and easily and gracefully.

where is ~\.vim folder in mac os? and how to install themes in gvim?

I downloaded color sample pack from http://vim.sourceforge.net/scripts/script.php?script_id=625
it says i should unzip and place it into ~/.vim but where is this folder? I tried unzip it to my usr/share/.vim folder but it is not working, I don't see themes added to gvim Edit>color scheme menu, and i tried "colorscheme sometheme", "color sometheme" in my gvimrc. Both not working for new themes
Isn't the ~/.vim should be the .vim folder in use/share? or I should create a new folder under home?
Note:there is a folder vim73 in my .vim, I guess this doesn't affect anything
thanks for any help!
First of all, open vim, and get help from :help colorscheme
:colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
for the file "colors/{name}.vim. The first one that
is found is loaded.
After reading the manual above.
Take the following steps maybe help you:
find runtimepath
:set runtimepath?
It will print out run-time paths:
runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim71,/usr/share/vim/vimfiles/after,~/.vim/after
create directory called colors under one of them if not exist(for example: ~/.vim)
$ ls ~/.vim
ls: cannot access /root/.vim: No such file or directory <== we need create it!!!
$ mkdir -p ~/.vim/colors
copy your color.vim to your colors directory
$ cp /path/to/your/color.vim ~/.vim/colors
restart vim to use new colorscheme
:colorscheme color
(optional) put command above to ~/.vimrc file to make it permanent
In UNIX parlance, ~ represents your home folder which is /Users/<username> in Mac OS X.
You are supposed to put all your custom scripts/colorschemes/whatever in a .vim folder situated in your home folder. In Terminal.app, type each line (without the $) then hit Enter:
$ cd
to be sure you are in your home folder
$ mkdir .vim
here you'll have an error message if ~/.vim already exists; if you don't receive a message it means that the folder is created
$ cd .vim
to move into it
$ open .
to open a Finder window here. At this point you should follow specific indications.

Resources