Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Saturday, December 1, 2012

OSX: Automatically Unmount Volumes on Startup Login.

Don't you hate it when you start your mac and you have a bunch of unwanted attached drives mounted on your desktop?

Specifically if you have Windows (via Bootcamp) or rarely used drives you dont want shown or accessible. It gets annoying to see those volumes mounted. For example, I don't want my wife to accidentally delete files off my Windows partition. I also have a clone drive of my system and whenever I double click on an image, Photoshop may launch from the clone drive instead of the one on my SSD system drive. I rarely use the clone drive except to mirror my working system drive once a week.

I prefer to manually mount those drives when I need them.


Here are the 3 drives I dont like littering my desktop: System Reserved, Windows, and my clone drive. System Reserve is the small boot partition that contains files to boot Windows. Delete any of those files and Windows wont boot.

Here is my solution I found somewhere off the net (I can't find the original link). You can write an Applescript to do this. Create the Applescript to unmount and load at login via the "Login Items" under "User & Groups" in the System Preference.

Here is the applescript. Modify with the volume name and save as an application.

 set volname to "System Reserved" -- # name of target volume 
 set p to (POSIX path of (volname & ":" as alias))'s text 1 thru -2 
 set sh to "diskutil umount " & quoted form of p & " &> /dev/null &" 
 do shell script sh 



Next, with the compiled Applescript(s) applications, go to User & Groups and go under Login Items and add your applescript(s). Also, I check off "Hide" so I don't see the script executes. It will re-run if you log off into another user and re-login back into your user account. Hiding it will run it in the background so if it errors,you won't see it.

Voila. Next time you boot, those drives wont show up.






You can easily remount the drives at any given time via the Disk Utility so this isn't a permanent thing.

Now, the only thing I can think of next is to stop OSX from prompting you to initialize a disk when it can't recognize the filesystem (e.g. Linux EXT4 or Vmware VMFS).


Thursday, November 29, 2012

Getting CPU info from the command line in OSX

Ever wonder what processor your mac is running and what features it has? Apple usually doesn't disclose the processor model name. Rather, they simply tell you it is a quad core i7 or dual core i5.


For example, does it support VT-d/VT-x? Well, in the command line, you can find out what processor it has and look it up on Intel's ark site.


For example, if you had an i7 3770k, you could go and get the full specs at by googling "ark 3770k" which gives you a link to the specs at : http://ark.intel.com/products/65523

In linux you can cat /proc/cpuinfo.

Well, I will show you the OSX equivalents. Instead of cpuinfo, we have sysctl To get the model name
in Linux In linux:
 grep "model name" /proc/cpuinfo 

In OSX, it is:
 sysctl -n machdep.cpu.brand_string 


To get full CPU info Linux:
 cat /proc/cpuinfo 
OSX:
 sysctl -a | grep machdep.cpu 


Want to know the core count and threads, you do another pipe grep. In OSX:

 sysctl -a | grep machdep.cpu | grep core_count 
 sysctl -a | grep machdep.cpu | grep thread_count 


Here is a full example:


Subscribe to: Comments (Atom)

AltStyle によって変換されたページ (->オリジナル) /