Showing posts with label OS X. Show all posts
Showing posts with label OS X. Show all posts

Friday, September 24, 2021

Links related to how force macOS to use integrated/discrete graphics


Copied from the above post in case the post is gone


sudo pmset -a gpuswitch 0

-b when on battery
-c when on AC power
-a always

0 iGPU only
1 dGPU only
2 automatic graphics switching

To reset everything back to default:
sudo pmset -a gpuswitch 2

Sunday, June 26, 2016

How to indent in Facebook post/comment on OS X


  1. Put your cursor on the text box of the post/comment you want to indent
  2. Go to the menubar at the top of the screen
  3. Edit > Emoji & Symbols
  4. On Characters window, click setting icon. It's a gear nearly the top-left of the window, close to 3 color buttons.
  5. Choose Customize Lists...
  6. Choose Code Tables > Unicode and Done
  7. Go to Unicode section at the end of the most left panel of Characters window
  8. Look for the character number 3000. It's called "IDEOGRAPHIC SPACE"
  9. Double click on that character to insert it to your text box. You can insert it as many characters as you want.
  10. Save your post/comment. This empty space should help you indent your text properly.
  11. You can add this character to Favorites section by click "Add to Favorites" button under the thumbnail of the character in the right most panel of the Characters window.
  12. Or you can just go to "Frequently Used" section and the character should already be there.

Tuesday, April 26, 2016

Set daemon config for Docker for Mac

Just follow what describe in this link How to run a insecure-registry

Capture the screen in case the link is gone in the future


Friday, November 27, 2015

Terminal.app doesn't save history in El Capitan and you are using RVM

The cause is described here https://github.com/rvm/rvm/issues/3540#issue-113491283
The fix is here https://github.com/rvm/rvm/issues/3540#issuecomment-152824133

I copied the fix here just in case it's removed in the future

Another option is to create .bash_logout with a single line:

shell_session_update

Tuesday, August 25, 2015

On OS X, Java Control Panel and Terminal show different Java versions

That's because Java Control Panel shows version of JRE for normal Mac user, but command line on Terminal shows version of JDK. To update JDK version, need to download the full package from Oracle website.
Older JDK version won't be replace automatically to allow us to switch back if we want. So we have to manually remove it by following the instruction here http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096903

Credit: http://stackoverflow.com/a/28254333

Wednesday, October 29, 2014

Get terminal to speak after finished a long processing command on OSX

Just append
 && say "Done"

For example;
 $ sleep 10 && say "Done"

This trick could be useful if you are running some tasks and want switch to work on something else while it's running but also want to get back to it immediately after it finished.

Source: How to make the hardware beep sound in Mac OS X 10.6


Friday, March 29, 2013

[Fixed][VIM] E354: Invalid register name: '*'

This error occurs when you or some of your vim plugins try to access register '*' which is a system clipboard. In default Mac OSX vim, it is compiled without system clipboard support enable. You can check this by run command :version inside vim. In the result, you will see -clipboard. Disable is -, enable is +.

To solve this issue, you need to compile vim with +clipboard yourself. I suggest OSX users to use brew to help this process. Out-of-the-box brew compiles vim with +clipboard. To do this run
brew install vim
Then you might need to create a new symbolic link from your vi command to point to the newly installed vim.
First you need to know the path of your new vim. Run
brew info vim
You should see something similar to /usr/local/Cellar/vim/7.3.875 in the result which means your vim binary file is at /usr/local/Cellar/vim/7.3.875/bin/vim. To create a new symbolic link for vi, first you need to remove the existing link
sudo rm /usr/bin/vi
Then you can create a new link.
sudo ln -s /usr/local/Cellar/vim/7.3.875/bin/vim /usr/bin/vi

Monday, May 28, 2012

Mac OS X Terminal shortcut keys

Terminal is one of the most frequently using application everyday but I have never had a chance to master its short keys. Today is a good day to start.

As I know, Terminal's short keys come from Emac, when I refer to meta short keys it means that you can use esc button or setting option(alt) button as a meta key. (Settings > Keyboard > Use option as meta key)

  • Ctrl + a = Go to the beginning of the line
  • Ctrl + e = Go to the end of the line
  • Ctrl + l or Command + k = Clear screen
  • Ctrl + r = Search for previous commands (pressing more r to get earlier commands)
  • Ctrl + w = Delete the word before cursor
  • Meta + d = Delete the word after the cursor
  • Ctrl + u = Clear the line before cursor
  • Ctrl + k = Clear the line after cursor
  • Meta + t = Swap last 2 words before cursor
  • Ctrl + d = Delete a character after cursor
  • Meta + f = Move cursor to the right one word
  • Meta + b = Move cursor to the left one word

Thursday, December 1, 2011

[MacOSX] How to modify enviroment.plist without any additional tools


  1. Convert enviroment.plist to XML format with plutil -convert xml1 environment.plist
  2. Edit it.
  3. Convert it back to binary format with plutil -convert binary1 environment.plist 

[RubyMine] invalid byte sequence in US-ASCII

I had this problem when I tried to bundle install. This causes from System Environment Variables which RubyMine is using is different from you shell and LANG is default to US-ASCII.

You can fix this (For 10.6+) by add LANG=en_US.UTF-8 to ~/.MacOSX/enviroment.plist

Please checkout How to modify enviroment.plist without any additional tools

Thursday, July 14, 2011

How to install PHPUnit to Mac OSX

- Install PEAR
curl -O http://pear.php.net/go-pear.phar
php -d detect_unicode=0 go-pear.phar


- Install PHPUnit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --force --alldeps phpunit/PHPUnit


- Set phpunit bin path to System Environment Variables

Credit
Getting and installing the PEAR package manager
PHPUnit Installed on Mac OSX

Saturday, September 18, 2010

Graceful OSX Shutdown from command line

If you use shutdown -h now running GUI programs will be forced to close. To tell them to close use
osascript -e 'tell application "System Events"' -e 'shut down' -e 'end tell'
Credit :

Tuesday, April 7, 2009

How to show hidden and protected files in OS X Finder

I have followed the method from the following blog How To Show Hidden and Protected Files in OS X Finder

but for my convenient I will make a summarize here.

There is just only 2 steps
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

boom!!! Your hidden files is shown.

Collectd PostgreSQL Plugin

I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...