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

Saturday, February 15, 2020

High CPU utilization just after display sleep in Hackintosh

I noticed that after a few seconds the monitors went sleep, the CPU utilization and iGPU utilization of my hackintosh went significantly high. This was clearly noticed in the Intel Power Gadget as well,




I kept a terminal session open redirecting the output of top command in terminal (top -o cpu > bla.txt). From the output I was able to find out that mediaanalysisd process was utilizing the CPU and iGPU.

After unloading mediaanalysisd, the issue went away.

Uload command I used,
launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist

Monday, February 10, 2020

Restore Google Chrome and Firefox Bookmarks from a backup

I had an issue with my Hackintosh, so that it wouldn't boot anymore. However I was able to mount the disk of the machine to another newly built Hackintosh which helped me to access the files of the troubled Hackintosh.

First I plugged the disk to the new Hackintosh

For Google Chrome,


1. Navigate to below location of the disk,

/Volumes/<volume name> - Data/Users/<username>/Library/Application Support/Google/Chrome/Default

2. There should be two Bookmark files in the directory:'Bookmarks' and 'Bookmarks.bak'

3. Check the latest by executing diff command

4. Copy the latest to below location of your new machine

/Users/<username>/Library/Application Support/Google/Chrome/Default


For Firefox,


1. Navigate to below location of the disk,

/Volumes/<volume name> - Data/Users/<username>/Library/Application Support/Firefox/Profiles/wzghbr3j.default/bookmarkbackups


2. There should be multiple files in the directory.
e.g.:

bookmarks-2020-02-08_744_<some-encoded-values>.jsonlz4
bookmarks-2020-02-09_744_<some-encoded-values>.jsonlz4


3. Pick the latest file and copy it to the desktop


4. Open Firefox, Select Bookmark and then Show All BookMarks


5. Click on Restore and then select choose file


6. Select the file from the Desktop

How to disable parsec-fbf which prevents Catalina Sleep functionality

1. Execute below command to find out which processes block sleep,

pmset -g assertions

2. Execute below command to disable parsec-fbf

launchctl unload -w /System/Library/LaunchAgents/com.apple.parsec-fbf.plist

Saturday, December 1, 2018

How to install youtube-dl on Mac OS

  • Install youtube-dl,

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl


  • Install ffmpeg which is useful to merge media streams,

    • Download the static snapshot from https://evermeet.cx/ffmpeg/
    • copy ffmpeg binary to /usr/local/bin,
      • sudo cp ffmpeg /usr/local/bin/

Sunday, November 25, 2018

Create a keyboard shortcut for Menu action in Mac OS X

While I was using my Hackintosh, I noticed that some menu items do not have keyboard shortcuts defined. Some menu items have keyboard shortcuts, but need special keys.
As an example, If you want to select Sleep menu item, there is a special key combination where one of the required keys "Eject" is not available in typical keyboards. However if you have Mac OS compatible keyboard, this will not be an issue.

There are multiple ways to overcome this. The easiest way I found was adding a new keyboard shortcut using system preferences. No additional software or scripting required.

These are the steps I followed to create a shortcut to Sleep menu action,


1. System Preferences -> Keyboard ->  Shortcuts
2. Select "App Shortcuts" from the left pane
3. Click on + (plus) sign
4. Select "All Applications" for "Application" option
5. Type "Sleep" for "Menu Title" Option
6.  Use your preferred key combination for "Keyboard Shortcut" option. I used Command + F12
7. Click on Add button

Adding a custom keyboard shortcut for Sleep menu action


That's it. Command + F12 will be shown as the keyboard shortcut for Sleep in the menu now,

Command + F12 keyboard shortcut assigned for Sleep menu action

Tuesday, November 20, 2018

How to add and remove default gateway on Mac OS

Command to delete the default route,

sudo route delete default

Command to add a default route,

sudo route add default <default gateway IP>

How to turn off IPV6 of an interface on MacOS

Command to list the network services,

networksetup -listallnetworkservices

output of the command,

anons-iMac:~ anon$ networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
Ethernet
iPhone USB


Command to turn IPV6 off for a particular network service (in this case Ethernet and iPhone USB are the network services I want to modify),

networksetup -setv6off Ethernet
networksetup -setv6off 'iPhone USB'

Sunday, January 10, 2016

How to fix Unibeast's "Selected Mac OS X Installer is Incomplete" error

Selected Mac OS X Installer is Incomplete

Your selected Mac OS X Installer is incomplete. Please delete all copies of the installer from all mounted volumes and redownload it again from the Mac App Store.

Do you receive above error message when you try to prepare a bootable USB  using Unibeast and a OS X installer downloaded from another machine, or a torrent? and you are 100% sure the downloaded installer is genuine copy?

Actually you can resolve this by doing either,
1. Simply changing the system time or
2. Patching Unibeast to remove a validation. 
(Changing 0000000100003262         je         0x1000032a2 to a NOP in Unibeast 6.1.1)

Both can be done easily. But I'm going to describe only the first option here. 

First let me explain few validations which are done by Unibeast before it allows you to create the bootable USB.

1. First validation it does is the Installer name and the path. Installer should be available at the /Applications directory with the correct name.

E.g.: 
/Applications/Install OS X Yosemite.app
/Applications/Install OS X El Capitan.app

2. Second validation is that,

If the installer is for Yosemite, then it checks for the string "com.apple.InstallAssistant.Yosemite" in the /Applications/Install OS X Yosemite.app/Contents/_MASReceipt/receipt file using "grep -q" command.

If the installer is for El Capitan, then it checks for "
com.apple.InstallAssistant.ElCapitan" in the /Applications/Install OS X El Capitan.app/Contents/_MASReceipt/receipt file using "grep -q" command.

3. The third validation is that it validates the signature of the receipt. This is the moment you get the "Installer is Incomplete" error message. This can happen either your receipt file is actually changed by someone or the certificates included in the receipt file are expired.

You can view the certificate information executing below command, (first change directory to /Applications/Install OS X xxx.app/Contents/_MASReceipt/ directory)

openssl pkcs7 -inform der -in receipt -print_certs -text

If your machine time is not within the validity period of the certificates, the signature validation is failed and Unibeast prompts the "Installer is Incomplete" error message.

e.g.:
openssl pkcs7 -inform der -in receipt -print_certs -text | egrep 'Not Before|Not After'
            Not Before: Nov 11 21:58:01 2010 GMT
            Not After : Nov 11 21:58:01 2015 GMT
            Not Before: Feb 14 18:56:35 2008 GMT
            Not After : Feb 14 18:56:35 2016 GMT
            Not Before: Apr 25 21:40:36 2006 GMT
            Not After : Feb  9 21:40:36 2035 GMT

In this case, the lowest "Not After time" is Nov 11 21:58:01 2015 GMT and the highest "Not Before time" is Nov 11 21:58:01 2010 GMT. Therefore the time of your machines should be within Nov 11 21:58:01 2010 GMT and Nov 11 21:58:01 2015 GMT.

Therefore if you change the machine time appropriately, let's say 2015/01/01 then Unibeast will proceed without prompting the  "Installer is Incomplete" error message. :)

Note: I think above validation was introduced by Unibeast developers to address a legal issue rather than making sure you have a genuine copy, because you can still have a modified installer files even when the receipt validation is passed.  So if you download the MAC OS X Installer from a torrent site or any other place, check the MD5 or SHA1 of the InstallESD.dmg file.

For Further reads about apple receipts,

Sunday, January 3, 2016

Building a hackintosh

First you need to read a lot about working builds before going in to building a hackintosh.
tonymacx86 is a very good resource on this subject and the community is very helpful.

I had only few options selecting motherboard and processes due to the availability in local computer market. Online purchasing was not an option due to the shipping cost.

Finally I decided to go with ASUS H97M-E and Intel i3-4330 haswell processor with integrated intel graphics (Intel HD 4600)
Make sure that the keyboard and mouse are USB and the monitor supports digital input (i.e. DVI-D or HDMI).

First you need to create a bootable USB with the target OS X. If you don't have a mac, you can prepare the USB using a VM. If you have a mac, then you can create the bootable USB easily.

Please note that this is not a step by step guide to build a hackintosh. However I have mentioned links which have the step by step guides useful in this process.

Download VMware Workstation

I was using Fedora 21, so I downloaded "VMware Workstation 12 Pro for Linux 64-bit".
Link: http://www.vmware.com/products/workstation/workstation-evaluation

Make sure that the version of the kernel and the version of the kernel-headers of your system are same. Otherwise the VMware installer will complain that it is unable to find the proper header files.

In my case they had different versions. So I updated the kernel.

[root@desktop9 ~]# rpm -q kernel-headers
kernel-headers-4.1.13-100.fc21.x86_64

[root@desktop9 ~]# uname -r
4.0.4-201.fc21.x86_64

[root@desktop9 ~]# yum update kernel

Unlock VMWare Workstation

You need to "unlock" VMware workstation to use your target OS X.

Download unlocker from here,
Link: http://www.daveparsons.net/downloads/unlocker207.zip

Run the unlocker script,
[root@desktop9 unlocker208]# ./lnx-install.sh 

Now it's the time to start the VMware workstation. Unfortunately VMware workstation threw errors and it was unable to start.

Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.

So I tried to load the required kernel module manually using modprobe.

[root@desktop9 ~]# modprobe vmmon
modprobe: ERROR: could not insert 'vmmon': Required key not available

After doing a google search I found out that the real reason for this error was the BIOS option "Secure Boot". I set the value for this bios option to "Other OS". After that the VMware workstation started.

Prepare ISO

Now you need an iso of the target OS X. I had Appstore copies of Mountain Lion and Yosemite operating systems. The original OS X comes as a dmg file. So you need to convert the dmg file to an iso.

I used dmg2img to convert Mountain Lion dmg file to an iso since the iso generated by the dmg2img for the Yosemite dmg didn't work with VMware workstation.

yum install dmg2img
dmg2img InstallESD.dmg InstallESD.iso

After that you will be able to use the iso on VMware workstation to create a new VM. Then you can use the VM to prepare a bootable USB with Yosemite or El Capitan using Unibeast.

Step by step instructions for preparing a Mac OS X VM on VMware workstation are available in this blog,
Link: https://mizitechinfo.wordpress.com/2014/07/13/installing-mac-osx-10-8-on-vmware-workstation/

Prepare the bootable USB using Unibeast

Unibeast seems very sensitive when it comes to finding the OS X from /Applications directory with correct names and files. It does not support to load an OS X installer from a user provided location.

If you already have a downloaded OS X installer, you need to copy that to the /Applications directory. However sometimes it complains that it couldn't locate the installer or the "installer is incomplete" if you copy the installer manually to /Applications directory.

If OS selection is greyed out in Unibeast, make sure that the OS X installer has the correct name and copied to the correct location.
e.g.: "Install OS X Yosemite.app" in /Applications directory.

Sometimes it still does not work even though the OS X installer is placed correctly. Try setting the system time to a previous year, e.g.: 2010 and rerunning the Unibeast in such a scenario.

Update: Please read this blog post if you are unable to make the OS X Installer recognized by Unibeast.
http://swapoff.blogspot.com/2016/01/how-to-resolve-unibeasts-selected-mac.html

Install the OS X

Once you have prepared the bootable USB, you should be able to use it to install the OS X on your build.

Step by step instructions on preparing the USB and installing it on your build using Unibeast and Multibeast are available in tonymacx86 site.