Showing posts with label OSX. Show all posts
Showing posts with label OSX. Show all posts

Wednesday, November 8, 2017

Shrink PDF Files in OS X and Control Image Quality

This guide is using information from here and providing clearer instructions and a Automator script to compress many at once.
  • Go here and click the green Clone or download button, then select Download ZIP.
  • Go to Downloads on your computer and rename the downloaded folder to Filters.
  • Make a new Finder window (Command+n) and then hold Option while clicking Go -> Library in the menu.
  • Drag the Filters folder with he files you downloaded into this new Library folder.
  • Download this program to your Applications folder or Desktop.
  • Now you can just all your PDF's files at once and drop them onto the application and it will compress them and save the compressed versions to your desktop.

Tuesday, October 25, 2016

Monday, December 28, 2015

Quick and Dirty OCR on OS X for Free

Wait, Stop, Don't spend that $80+ on some fancy OCR software just yet.  There are some free open source tools out there and with a bit of work you can have very functional workflow using them and OS X. This guide will help you set up an applet you can drop images onto to OCR them to plain text.  This will not create PDF's, formatted, or indent documents, but rather just one large text block that is structured the same as the source text with line breaks.  The following tools are used, but instructions are provided below so you don't need to download anything from the sites.
  • Homebrew The missing package manager for OS X
  • Tesseract Open Source OCR Engine
  • Automator

Friday, October 2, 2015

Problems with Java Based OS X Applications Hanging when Entering Text

So I found another problem with my new upgrade to OS X 10.11.  That is that the Java web application I was using, Adobe Ad Hoc Analysis in this case, would hard lock every time i tried to enter text in a text box.  The only solution was to force quit the application.  After much testing I found the culprit was the RescueTime helper applet.  Basically this applet gets Accessibility access so that it can inspect windows and record time used but is glitching on the java windows and causing the lock up.

There could be other programs causing the same issues even if you don't use RescueTime but are having the same problem.  To troubleshoot do the following.

  • Close out of the java program that is locking up.
  • Open System Preference > Security & Privacy > Privacy > Accessibility.
  • Note with items are check and then uncheck them all.
  • Restart your java program and attempt to reproduce the issue.
  • If it is working correctly then quit, re-enable one item, and try again until you find the culprit.
  • If you can't get around the error even with all Accessibility options off that you must have some other issue.
Anyway if you find any items fix the problem you can just leave them off though they might hinder there applications functionality.

OSX 10.11 Stuck On Grey Screen After Login

After upgrading to El Capitan yesterday I ran into an issue where my computer would boot up going through the loading bar and display the login screen if  enabled.  Upon logging in, or automatic login, the system would hang at a grey screen.  After some testing with the network I figured out that it was not actually locking up and would respond to traffic.

To determine if your issues is due to the same problem wither SSH into the computer once booted if remote login was enabled or boot to Recovery Mode  and launch the Terminal.  Then run the following to see recently logged errors.

tail /var/log/system.log | grep 'Segmentation fault'

Or if using the Recovery Mode terminal the following thought the drive name may be different.

tail /Volumes/Macintosh\ HD/var/log/system.log | grep 'Segmentation fault'

If either of these commands produce any results that you have found your problem.  The culprit is Unsigned Kernel Extensions or .kext modules.  In the good old days developers could just install these as needed to add code level kernel functionality but no for improved security OS X requires that all Kernel Extensions be signed by the developer.  This is overall a good thing because these are privileged and could easily lead to malicious behavior by untrusted sources.

Anyway the problem where is that the upgrade didn't disable the unsigned Kernel Extensions it found and instead just doest't load them.  This is fine and normally it would just mean that whatever applications depend on them would jus not work until updated but for whatever reason there are a few special cases that cause the login process to hang.  I ended up removing all the Virtual Box and Soundflower modules and then was able to boot without issue.  I have not tried to Re-install or upgrade wither yet but atlas my computer boots.

To remove these again go to the Terminal and do the following.  You will nee to authorize them with your administrative password.

sudo rm -Rf /System/Library/Extensions/Waco*
sudo rm -Rf /Library/Extensions/VBox*
sudo rm -Rf /Library/Application\ Support/VirtualBox/*
sudo rm -Rf /System/Library/Extensions/Soundflower*
sudo rm -Rf /var/folders/*

Again note the additional prefix if using the Recovery Mode ant that thedick name may be different.

sudo rm -Rf /Volumes/Macintosh\ HD/System/Library/Extensions/Waco*
sudo rm -Rf /Volumes/Macintosh\ HD/Library/Extensions/VBox*
sudo rm -Rf /Volumes/Macintosh\ HD/Library/Application\ Support/VirtualBox/*
sudo rm -Rf /Volumes/Macintosh\ HD/System/Library/Extensions/Soundflower*
sudo rm -Rf /Volumes/Macintosh\ HD/var/folders/*

Finally just reboot and enjoy.

Monday, March 23, 2015

Prevent Google Chromes on OS X from navigating when scrolling

I have been having this very irritating issue when using the Apple Magic Mouse and Google Chrome.  No matter what I tried when I would use the vertical finer scrolling gesture to scroll up and down the page Chrome would go back and forward in the page history when scrolling to the top or bottom of the page.  This was vary frustrating and is apparently a but in the Chrome touch implementation as it happened in no other browser.  After much headaches, I could just turn off two finger navigation but I use it in other browsers where it works correctly, I finally found a solution.

The Solution:

Open up Terminal and Enter the following.
defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
<enter>

Tada!

Friday, September 7, 2012

Friday, September 16, 2011

Using a single Windows 7 install with Boot Camp and VMware Fusion

09/17/2011- Update: Updated the power on-vm-custom script to add /persistent:yes.  Without this extra parameter the drive mapping immediately disconnects when the login scripts finish which is not what we are looking for.

I recently put a SSD drive into my iMac running OSX Lion. When I did this I also decided to create a single Windows 7 install for use in Boot camp and VMware Fusion. Below is a brief overview of the process and the decisions I made along the way.


I started out by using the Boot Camp Assistant to create a 20 GB(Probably should have been closer to 30GB) partition on the SSD drive(120 GB) I installed. I will only be using this partition for the operating system and drivers and have a 700GB external Firewire drive for all other data.

I installed Windows 7 64bit on this volume and loaded it with the proper Windows 7 Boot camp drivers and all the Windows Updates.

Next I installed VMware Fusion 3 created a new Virtual Machine with the Boot Camp partition.  This is only a pointer to the partition and not a copy and as such the VM itself is only a few megabytes.  After this was done I booted up the VM and configured the VMware tools.

I now have a single operating system that can be used in the VM or as a native OS.  To simplify the switching between the two Operating Systems I also installed BootCamp.

Next I configured Windows to automatically log in when booting to speed the startup/reboot times.  To do this open Window, press Command-R, and enter control userpassword2. not uncheck the option to require users to login and enter the username and password you want to automatically log in with.


Setting up shared access to a NTFS partition from both Boot Camp and VMware Fusion.

Next up is tackling the problem of the second hard drive.  I could have just created one large partition and been done now but the SSD eliminates the option.  Also I can't directly attach the external firewire drive to Windows XP become there is another partition on is for use in OSX.  As a result I am limited to make a few modifications to make it usable.  First off I configured the drive with two large partitions with Disk Utility(The first is a HFS+ volume with my OSX home directory and documents).  Then I Booted into Boot Camp and formatted the second column as NTFS for use in windows.  This drive will now automatically connet when booting in Boot Camp as E:\.

This was only half the battle though as previously mentioned when booting in VMware this column isn't accessible.  The solution to this is to enable Sharing in the Virtual Machine settings.  Now click Add, select the proper volume, and make sure it is set to Read & Write.  Note that you definitely want to leave Mirrored folders off here or you will have problems when booting back to Boot Camp.  You can also add other folders to share here like tour home folder or other external volumes.

Now you may have noticed that this volume is Read Only.  This is a limitation of OSX but there is a NTFS-3G Driver that will enable write access to the drive.  When installing be sure to chose the Cache option as the performance is needed and on a power failure only the programs will be vulnerable, not the OS itself.  Once installed you don't need to reboot, just click the X at the last screen then un mount the column and user Disk Utility to re-mount it.  You can now write to the NTFS volume all be it as a slightly reduced speed.

Upon booting VMware we not get a Z:\ shared folder with this external drive listed within it.  This will not work though as the applications will not be installed in the same location in both modes.  To fix this we need to create a login and logout scrip in VMware.  Open up C:\Program Files\VMware\VMware Tools  and make copies of the poweron-vm-default and poweroff-vm-default scripts.  Now open up My Computer, Z:\, and the shared external volume.  Copy the full path from the address bar at the top of the window.

Edit the poweron-vm-copy script and add the following line where DRIVE is the drive letter expected in windows and PATH is the path copied previously.
net use DRIVE: "PATH" /persistent:yes
Edit the poweroff-vm-copy script and add the following line where DRIVE is the same drive letter again.
net use DRIVE: /delete


For example here are mine:
net use e: "\\vmware-host\Shared Folders\Windows HD" /persistent:yes
net use e: /delete

Finally open up VMware tools and change the Shut Down Guest and Power On Guest scripts to point to the appropriate files we just created.  Now reboot and enjoy seamless reboots and convenience.


Other notes:
  • With this setup and the SSD I can switch back and forth between anteing and emulated environments in less them a minute.  
  • I also have both operating systems configured to load the majority of their applications and data onto the external drive and hold only the OS and working files on the SSD.  The only real exceptions to this are in OSX where most applications are acutely on the SSD as in both OS's the user profiles are still on the SSD.  I all detail my OSX setup in a future post.
  • You will notice that you can't use BootChamp to reboot when the VM is running.  You need to shut down Windows first before you can reboot to Boot Camp.  VMware does not acutely need to be exited and I tend to leave the application running and the VM set to auto start so that earn I boot back to OSX the VM automatically starts back up.

Thursday, July 28, 2011

Remotly Enable VNC/Remote Management on OSX by SSH

I had the VNC based remote access feature of OS X enabled on 10.7 but somehow it got switched off.  I fiddled around a bit and figured out how to enable remote access from a remote SSH shell.  Note that these instructions will lead to manual configuration and you will not be able to enable/disabled the services from the System Preferences anymore.  In my case I used this to get in when I needed to but latter switched it back off and used the System Preferences setting.

To manual switch on remote access from the terminal:
ssh username@mac_ip_address
cd /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources

sudo ./kickstart -activate -configure -access -on -privs -all -restart -agent

To switch this override back off and thus allow the System Preferences to manage screen sharing again run the following. (This will disconnect any active sessions and require physical access to re-enable it.)
sudo ./kickstart -activate -restart -agent 

Monday, May 9, 2011

OSX Slow Boot / Can't Change Boot Volume

I recently had a very odd problem with my iMac. I have a after market SSD in it and have Boot Camp set up with Windows 7. It has been working fine for about a year now but all of the sudden my boot time tripped and I was no longer able to switch OS's with BootChamp nor set a startup volume in System Preferences.

After some investigation I found the following symptoms and error messages:
  • There were some scree rendering issues / I could mouse the mouse but not click or type.
  • I was able to use Remote Desktop / VNC to connect and interact with the computer properly.
  • In Activity Monitor the kernel_task process was using 100% of the CPU on one of the cores.
  • I could boot to Windows at startup and had no problems, errors, or lag there.
Could not find IODeviceTree:/options
EFI found at IODeviceTree:/efi Mount point for /Volumes/BOOTCAMP is /Volumes/BOOTCAMP
flushing fs disk buffer returned 0x5
IOHIDSystem: postEvent LLEventQueue overflow.
Can't access "efi-boot-device" NVRAM variable
no bootx creation request
nvram: nvram is not supported on this system

One of the messages when I was testing the Unix bless command indicated that the "efi-boot-device" NVRAM variable was not accessible. I then tried to examine it with the Unix nvram command only to get the "nvram: nvram is not supported on this system" error. I found the NVRAM error very odd And was surprised the computer was even booting if the nvram was defective. I then tried to reset the NVRAM as it was not operating properly.


Solution:
As it turned out the problem all along was that the NVRAM had corrupted and was non-functional. I did a hard reset of the NVRAM and all the problems went away immediately. To reset the NVRAM you just reboot and hold down Command, Option, P, and R as the computer boots, or see this Apple Document.

Wednesday, February 10, 2010

Find Duplicate Files in the Terminal

I posted an Automator Service last week for finding duplicate photo's in an iPhoto Library.  Here is a slightly modified version of the internal script it uses. You can save this script and run it in a terminal to find duplicate file of any kind in any directory tree of your choice.  This can also be included in Automater actions itself with the Shell Script action.

findDuplicates.pl
#!/usr/bin/perl

# ##################################### #
# Filename:      findDuplicates.pl
# Author:        Jeremy Pyne
# Licence:       CC:BY/NC/SA  http://creativecommons.org/licenses/by-nc-sa/3.0/
# Last Update:   02/10/2010
# Version:       1.5
# Requires:      perl
# Description:
#   This script will look through a directory of files and find and duplicates.  It will then
#   return a list of any such duplicates it finds.  This is done by calculating the md5 checksum
#   of each file and recording it along with the filename.  Then the list is sorted by the checksum
#   and read in line by line.  Any time multiple records in a row share a checksum the file names
#   are written out to stdout.  As a result all empty files will be flagged as duplicates as well.
# ##################################### #

# Get the path from the command line.  Thos could be expanded to provide more granular control.
$dir = shift;

# Set up the location of the temp files.
$file = "/tmp/pictures.txt";
$sort = "/tmp/sorted.txt";

# Find all files in the selected directory and calculate their md5sum.  This is by far the longest step.
`find "$dir" -type file -print0 | xargs -0 md5 -r > $file`;
# Sort the resulting file by the md5sum's.
`sort $file > $sort`;

open FILE, "<$sort" or die $!;

my $newmd5;
my $newfile;
my $lastmd5;
my $lastfile;
my $lastprint = 0;

# Read each line fromt he file.
while() {
        # Extract the md5sum and the filename.
        $_ =~ /([^ ]+) (.+)/;

        $newmd5 = $1;
        $newfile = $2;

        # If this is the same checksum as the last file then flag it.
        if($1 =~ $lastmd5)
        {
                # If this is the first duplicate for this checksup then print the first file's name.
                if(!$lastprint)
                {
                        print("$lastfile\n");
                        $lastprint = 1;
                }
                # Print the conflicting file's name/
                print("$newfile\n");
        }
        else
        {
                $lastprint = 0;
        }

        # Record the last filename and checksup for future testing.
        $lastmd5 = $newmd5;
        $lastfile = $newfile;
}

close(FILE);

# Remove the temp files.
unlink($file);
unlink($sort);

Friday, January 29, 2010

Auto Mount NFS Shares via Bonjour

07/21/2011 - Update
It papers this site is no longer available.  As such I have posted the original script here and the automated workflow is  here.

There are also installation instructions for OSX 10.7 which is working but requires some extra setup and Xcode must also be installed before the scripts.

Installation:
  • Download the two file above and extract them someplace.
  • Drag the Automator action into our Applications folder and add it to your user accounts Login Items list so that it will automatically run each login.
  • Setup the background script to do the actual work.
Open up the Terminal application and locate the directory you saved the script into.
cd ~/Downloads

Run the following commands to install the script locally.
sudo mkdir -p /usr/local/bin
sudo cp bonjournfsmd.rb /usr/local/bin/bonjournfsmd.rb
sudo chown root:wheel /usr/local/bin/bonjournfsmd.rb
sudo chmod +x /usr/local/bin/bonjournfsmd.rb

Run the following commands to install some dependancies required on OSX 10.7 only.
sudo gem install dnssd
sudo gem install daemons

A wile back I switched my server over to FreeBSD/ZFS and ended up changing the shared volumes to use the NFS features of ZFS.
There were a few minor issues with the initial configuration and the OSX clients but this was not to difficult to resolve. Specifically the NFS system does not allow for user account mapping, but rather the accounts on both the server and client must be identical. Furthermore this mapping is not done by username, but rather by the UID of each user. On OSX the UID start at 501 where as on FreeBSD they default to 1000. The best approach to fix this problem is simply to update the account on the BSD box to use the same UID as OSX. (It is possible to change UID in OSX but not recommended.) After this fix everything was working correctly including write access and ACL lists.
The other thing I wanted to do, and the reason for this post, was to have my OSX desktop automatically map these volumes on boot. I found a simple Bonjour NFS share Mounter Daemon, http://svwtech.com/site, that can be run from the terminal and will do exactly that but I was unable to get the script to run at boot. In the end I had to create a Automator application to run the script and then add that application to my startup items.
You can download the Application with the above auto-mount script embedded in it here.

Find Duplicate Photos in an iPhoto Library

03/04/2011- Update: Updated the service with some fixes for invalid paths and quoting problems.
06/23/2016- Update: Updated download link. I'm not really sure if this still works with newer versions of iPhoto or Photo's though.

There are many shareware tools for finding duplicate pictures in an iPhoto library but this should be a simple operation, and honestly shouldn't require a fee to utilize. As a result I created a simple Service via Automator to solve this problem.

Friday, October 10, 2008

Comfigure Gmai to stay online in Mail.

Here is another tip for Gmail users that want to work in Mail.app.

When you set up a Gmail account in Mail.app it will default to POP. Now that Gmail supports IMAP you can use that instead. The difference between the two is simply that POP downloads everything from the server and works locally where as IMAP access the server and works directly there.

The two major benefits to using IMAP are that any changes you make to your mailbox locally. First of moving a message from one folder to anther is reflected on the server and secondly only a list of message is retrieved instead of the entire mailbox.

The second benefit isn't quite true though as Mail.app by default downloads the entire mailbox and all the attachments for offline viewing. Now as I rarely use Mail.app and furthermore never use the offline mode, I disabled this feature and substantially improved the Gmail synchronization. Not only the headers are cached and the message and attachments are retrieved when I open a message.

To change this setting you will need to remove your Gmail account, to clear out the cache, and add it again, this time manually set it up and on the last screen uncheck "Take this account online". This will prevent syncing. Now go to the Advanced tab and change "Keep a copies of messages for offline viewing" to "Don't keep copies of any messages".

Problem Syncing Gmail with Mail 3.0 in OS X 10.5

I general use Gmail via the web but I do have it configure in Mail.app for IMAP access as well for sending photos and files more easily. I was trying to send some photos today and had a problem with mail hanging as it were. It wasn't exactly crashing, but upon launching it would just sit there trying to sync and send files but never succeed. This blocked access to the IMAP. I verified the configuration but there were no problems.

As it turns out the problem was that Mail.app was trying to redo some task that had failed at an earlier time and these tasks were no invalid. Probably send some photo's that no longer exist. To clean up this problem just execute this command in a the terminal.


rm ~/Library/Mail/IMAP-*/.OfflineCache/*