Difference between revisions of "macOS"
m |
|||
Line 7: | Line 7: | ||
<pre> | <pre> | ||
qlmanage -p FILENAME.jpg | qlmanage -p FILENAME.jpg | ||
+ | </pre> | ||
+ | |||
+ | == Paste Board (clip-board, Desktop cut-and-paste) == | ||
+ | |||
+ | <pre> | ||
+ | pbcopy < foo.txt | ||
+ | pbpaste >> bar.txt | ||
</pre> | </pre> | ||
Revision as of 19:30, 20 May 2015
Contents
- 1 Display images from the command-line
- 2 Paste Board (clip-board, Desktop cut-and-paste)
- 3 Mount extfs ext2 ext3 ext4 on Mac OS X using FUSE
- 4 How to resolve: "No Java runtime present, requesting install."
- 5 Mac OS X keyboard modifiers get reset after boot or sleep
- 6 Brew: installation of Brew packages fail with "/usr/local/lib/pkgconfig is not writable."
- 7 Show all files in the Finder -- show hidden files
- 8 .DS_store sucks
- 9 Fink
- 10 Show top level mounted drives (volumes) in the Finder
- 11 Use Automator to set a global system hotkey to launch a new iTerm window
Display images from the command-line
This works on almost any file as well as images.
qlmanage -p FILENAME.jpg
Paste Board (clip-board, Desktop cut-and-paste)
pbcopy < foo.txt pbpaste >> bar.txt
Mount extfs ext2 ext3 ext4 on Mac OS X using FUSE
If you use a Mac and want to mount Linux extfs drives then the easiest way to do this is to use FUSE for OS X with fuse-ext2. OSXFUSE is based on a defunct project called MacFUSE. fuse-ext2 does not appear to be updated frequently, but the old releases seem to work on the latest version of Mac OS X (Mavericks).
How to resolve: "No Java runtime present, requesting install."
When trying to run java from the command-line you may get this message, No Java runtime present, requesting install.. After installing the JRE: (Java Runtime Environment), you find that you still get this message from the command-line. Restarting the terminal session does not fix this. You must add the following line to /etc/bashrc or your own ~/.bashrc:
export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
Mac OS X keyboard modifiers get reset after boot or sleep
If you set your Caps Lock key to be a Control key you may find that this setting gets lost after the machine reboots or restores after a sleep. The problem may be with a corrupt ~/Library/Preferences/.GlobalPreferences.plist file. To fix this delete or move this file out of the way, reset the Caps Lock key modifier back to Control then reboot. The problem should go away.
Brew: installation of Brew packages fail with "/usr/local/lib/pkgconfig is not writable."
During a step that creates symlinks you may see a message like this:
Error: Could not symlink file: /usr/local/Cellar/x264/r2197.4/lib/pkgconfig/x264.pc /usr/local/lib/pkgconfig is not writable. You should change its permissions.
I'm not sure what causes this. This seems to fix it; although, I'm not sure if this is the correct ownership to set:
sudo chown -R $USER /usr/local/lib/pkgconfig
In Open and Save dialog boxes you can press Command-Shift-. (dot) to temporarily show hidden files. If you want to see hidden files in the Finder then run the following from a command-line shell.
defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder
.DS_store sucks
.DS_store spreads like the common cold. There is no way to turn it off for locally mounted drives, including removable media, but you can disable it from being created on network drives.
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Also add to your .gitignore file:
.DS_store/
Fink
I mostly use "brew" now.
Install Fink and Fink Commander.
Install [XCode].
Show top level mounted drives (volumes) in the Finder
This is some same Applescript that I wrote. This gets me started with the basics.
(* Show top level mounted drives (volumes) in the Finder *) tell application "Finder" activate make new Finder window with properties {target:computer container} (* I can't set the column view in properties when making new Finder window because the user may have set the Finder view option "Always open in list view". *) set current view of front window to column view set zoomed of front window to true (* if using list view then adjust some of the columns... set sort column of list view options of front window to name column set sort column of list view options of front window to kind column set width of column id name column of list view options of front window to 200 set width of column id modification date column of list view options of front window to 170 set width of column id size column of list view options of front window to 90 set width of column id kind column of list view options of front window to 120 *) end tell (* tell application "System Events" if UI elements enabled then keystroke "t" using {command down, option down} else tell application "System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\"" end tell end if end tell *)
Use Automator to set a global system hotkey to launch a new iTerm window
This doesn't work very well because it turns out that a lot of applications use Option-Command-T. I would like to find a better solution to this problem.
In Automator create a new document and select a Service" as the type for your new document. Set the following options:
Service receives: no input in: any application
From the Library add the action Run AppleScript and set the following text in the editor:
on run {input, parameters} tell application "iTerm" reopen activate end tell tell application "System Events" to keystroke "n" using command down end run
Save the workflow as hotkey iTerm.
Open System Preferences to set a hotkey to launch the work flow.
System Preferences | Keyboard | Shortcuts | Services | General | hotkey iTerm
Add a shortcut and press alt-command-t to set this hotkey sequence to launch a new iTerm window. I tried ctrl-alt-t and ctrl-command-t, but these were being used by other applications.