Showing posts with label mac_osx. Show all posts
Showing posts with label mac_osx. Show all posts

Friday, September 09, 2016

Python pip Broken After Upgrade To OSx El Capitan

Wow its been a long time since I blogged.  I have no excuse other than things have been a touch crazy.  My work recently started allowing us to upgrade our Mac's from Yosemite to El Capitan.  For me the upgrade only took about 45 minutes, which is pretty quick in the grand scheme of things.  The download is a little over 6 gb and went pretty quickly.  

I was going along fine until today when I tried to install a new module using pip.  About 1/2 way through the installation I was presented with the following output:

    In file included from src/lxml/lxml.etree.c:321:
    src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
    #include "libxml/xmlversion.h"
             ^
    1 error generated.
    Compile failed: command 'cc' failed with exit status 1
    creating tmp
    cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitf3OxN6.c -o tmp/xmlXPathInitf3OxN6.o
    /tmp/xmlXPathInitf3OxN6.c:1:10: fatal error: 'libxml/xpath.h' file not found
    #include "libxml/xpath.h"
             ^
    1 error generated.
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    Perhaps try: xcode-select --install
    *********************************************************************************
    error: command 'cc' failed with exit status 1
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-9IduXA/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RgavmY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-9IduXA/lxml/

I had installed other modules last week, but then I realized that that was prior to my upgrading.  I looked at the above output and noticed the line:

     Perhaps try: xcode-select --install

OF COURSE!!!  Although I upgraded, and XCode had been upgraded to, I still needed to do some things with XCode to get things going again.  First, I opened XCode and went through its initial startup after an upgrade.  A bunch of clicking and things were good there.  I then opened up my command line and, prefixing the command with 'sudo', I ran the 'xcode-select --install' command from above.  This presented me a pop-up window to install tools.  So, I accepted and allowed it to install.  Once finished, I tried my pip module installation again and VOILA!!!!  It worked!!!

So, in this lesson, always make sure to update your XCode and xcode-select before moving on after an upgrade.

Wednesday, January 21, 2015

OSx 10.10.1 Annoyances

If you have had a Mac for any length of time, you are probably used to upgrading to the latest version of the OS when they release it.   Of course within the past couple of years we have all learned that we even have to be wary of Apple and its releases, as they have not been perfect by any stretch.  

My work is holding off on the latest release due to incompatibilities with some pieces of software.  This didn't stop me though, and this was because:  1. I had already upgraded, and 2. Luckily it turns out I didn't use the software in question.  Yay!

But, I have noticed that there are a couple of things in the new release that I find particularly annoying, especially since the modified behavior that I had either previously set specifically, or that was already a default action(and I preferred).

The first one is the setting in System Preferences for automatic display brightness adjustment.  I find this setting annoying as I don't like my computer deciding how bright my screen is supposed to be.  Also, having the screen brighter certainly drains a bit more of the battery.  My eyes are adjusted to having it set lower, and I like it that way.  Plus, when you have a headache(or migraine as I tend to get), the last thing you want is a brighter screen.  

With the 10.10.1 release, the update turned on automatic brightness adjustment.  It took me about an hour to actually notice it.   But if you want it off (like me), go to System Preferences -> Displays and uncheck the box next to "Automatically adjust brightness".  

The other setting that really irked me was that after updating to 10.10.1, I noticed that the default behavior of the machine when you close the lid had changed.  For the longest time the action was to put the computer to sleep when you shut the lid.  After updating, the default action was to hibernate.  As people have probably experienced, hibernate is a royal pain, mostly because when you open your laptop, you have to press the power button and then wait for it to restore.  On a Mac, when you sleep it, you simply open the top and the display comes alive almost right away (within a couple of seconds typically) and you can then log in and get right to work.  Pretty much almost no waiting.  Hibernate is a sloth to come back in comparison to sleep.  

I had to do a little digging to figure out how to fix this.  What you need to is open up your command line terminal and enter the following to make sleep the default when the lid is closed:

  sudo pmset -a lidwake 1

After that, if you shut the lid, it should simply sleep.  Now, some people are probably saying, "Why not just specifically tell it to sleep?".  The reason is to save time.  Instead of taking the time to go to the menus and click sleep, you can simply shut the top of your laptop and have it automatically do it for you.  

Again, these are my annoyances with OSx 10.10.1.  If you are not bothered by them, then continue on.  Otherwise, I hope this helped to fix them for you.

Tuesday, July 08, 2014

Homebrew and the Untracked Working Tree Files

On the Mac, you have package managers that are designed to allow you to install software via the command line.  Two of the majors are MacPorts and Homebrew.  This is specific to Homebrew as that is the one that I chose to use for my system.

If you are like me, you install the software you need and then don't touch Homebrew for a while.  During the lapse in use, the system tends to get stale and you will find that before you search for software or are able to install anything, that you must  first update it.

The update is usually simple and run as follows:
sudo brew update
Unfortunately, its not a perfect system, and will let you know this by pretty much bitching and complaining and exiting, refusing to update.  The output of such a hissy fit looks similar to this:

> sudo brew update --force
error: The following untracked working tree files would be overwritten by checkout:
Library/Aliases/fishfish
Library/Aliases/fluidsynth
Library/Aliases/gearmand
Library/Aliases/git-tig
Library/Aliases/gnu-scientific-library
Library/Aliases/google-go
Library/Aliases/gperftools
Library/Aliases/gpg
Library/Aliases/gpg2
Library/Contributions/brew_bash_completion.sh
Library/Contributions/brew_fish_completion.fish
Library/Contributions/brew_zsh_completion.zsh
Library/Contributions/cmd/brew-aspell-dictionaries.rb
Library/Contributions/cmd/brew-beer.rb
Library/Contributions/cmd/brew-bundle.rb
Library/Contributions/cmd/brew-cleanup-installed
Library/Contributions/cmd/brew-dirty.rb
Library/Contributions/cmd/brew-gist-logs.rb
Library/Contributions/cmd/brew-graph
Library/Contributions/cmd/brew-grep
Library/Contributions/cmd/brew-leaves.rb
Library/Contributions/cmd/brew-ls-taps.rb
Library/Contributions/cmd/brew-man
Library/Contributions/cmd/brew-mirror-check.rb
Library/Contributions/cmd/brew-profile.rb
Library/Contributions/cmd/brew-pull.rb
Library/Contributions/cmd/brew-readall.rb
Library/Contributions/cmd/brew-server
Library/Contributions/cmd/brew-services.rb
Library/Contributions/cmd/brew-switch.rb
Library/Contributions/cmd/brew-tap-readme.rb
Library/Contributions/cmd/brew-test-bot.rb
Library/Contributions/cmd/brew-tests.rb
Library/Contributions/cmd/brew-unpack.rb
Library/Contributions/cmd/brew-which.rb
Library/Contributions/cmd/git
Library/Contributions/cmd/public/bootstrap.min.css
Library/Contributions/cmd/public/glyphicons-halflings-white.png
Library/Contributions/cmd/public/glyphicons-halflings.png
Library/Contributions/cmd/svn
Library/Contributions/example-formula.rb
Library/Cont

No matter what you do with the brew command (at least from what I have found), you won't be able to update.  What is nice though, is that brew uses git to do its checkouts and updates.  And, for your knowledge going forward, brew uses /usr/local as its base directory.  So, the easiest way that I found to correct this issue and update brew is to completely bypass the command and go straight to git.  

The following set of commands should work to get your brew back up and working(note, I am sudo running these commands):
# cd /usr/local
# git fetch origin
# git reset --hard origin/master
After doing the above, you should find that running brew update has the following results:

# brew update
Already up-to-date. 
Why?  Because you just circumvented the brew command and updated it manually.  You can now run 'brew search ' or whatever other brew command you were going to run.  Have fun!

Saturday, August 17, 2013

Easy CD Ripping on Mac OSx

As we all know, there are a plethora of applications out there to rip music cd's to mp3 format.  All of them have some kind of learning curve, as well as learning to configure them properly, not to mention, some of the better options will cost you a few $$ out of pocket if you want to use them. 

In this post, I will show you how to easily configure your iTunes software to import a music cd and convert it to MP3 on the fly.  The only limitation that some will skoff at, is that it only seems to support up to 192kbps.  For me, this is not an issue as I tend to use 192 by default.  I have found the higher rates above 192 don't always play or are sketchy when playing, but that's just my observance.

For these instructions, I am using iTunes 11.0.4 on OSx 10.8.4.  If you are using something different (including Windows), your going to have to figure out where to go.  Hopefully it won't differ to greatly.

The first thing you will need to do, after putting your cd in you Mac and selecting it from the source drop down menu, is to go to iTunes->Preferences in the top menu.   When the window appears, you will need to be in the General tab. On that screen, look for the section called "When you insert a CD:"  Here is what it looks like.


Once you found the above, you will click on 'Import Settings'.  The new window that opens will look like this:


In the above, you will want to set your settings as shown.  The 'Import Using' setting is important for the conversion to MP3.  After changing the settings, hit "Ok' to save them. 

When the tracks are converted to MP3, iTunes will save the files to the designated 'iTunes Media folder location'.  You can find out what this is, and even change it, on the 'Advanced' tab.  Once you are done, hit 'Ok' to go back to iTunes.  

The only thing left is to click on the 'Import CD' link in the upper right corner of the iTunes window.  This will begin the import and conversion of the files.  Believe it or not, its not that awful and only takes a several minutes per CD to rip all of the tracks.  

I hope this tutorial provided what you needed to rip mp3s with iTunes.  

Sunday, July 14, 2013

Adding Desktop Spaces in OSx 10.8.x

This is one of those things that is different between earlier versions of OSx and the current version.  To be honest, I find it much easier in today's version than it was earlier.

In the earlier version's of OSx (I am not really sure of which version it was changed), you would go to System Preferences, and under Personal there was an item called "Expose and Spaces", where you would configure your desktop spaces.

Now, with the advent of gestures making it a bit quicker to do certain things, like switching desktop spaces, you can also add desktop spaces.

How?  Using what is called the "view Mission Control" gesture, where you use 3 fingers together and drag them upwards on the mouse pad, you are presented with a display of your desktops and your running applications.  You can drag your apps to different desktops from here.  If you bring your cursor to the upper right corner, a "+" sign will appear.  Click it and it will add a desktop to your spaces.  If you happen to add one to many, or want to reduce the number of desktop spaces you have, then simply hover over the desktop(s) you wish to get rid of and an "X" will appear in its upper left corner.  Simply click the "X" to get rid of the desktop space.

For those that are somewhat new to OSx and are not totally comfortable with gestures and want to learn, Apple has provided some quick videos.

I hope this helped.

Wednesday, September 14, 2011

OSx and the bashrc

A couple of months ago I purchased my first Mac, a 13" Macbook Pro.  I have to say that I am absolutely loving so far.  The interface is pretty sweet, but for me the best part is that its got a *nix back end.  Learning a new environment like OSx after coming from the Linux world is not a difficult transition, but it certainly has its little speed bumps.

This evening was one such speed bump when I decided to add some things and customize my .bashrc.  The first thing I noticed….. there wasn't a .bashrc in existence yet on the system.  This simply told me that it was pulling its initial settings from /etc/profile (which in turn sources /etc/bashrc on OSx Lion).

So, I went and created my own .bashrc in my home directory, added my settings that I liked to have and copied some of the stuff from the default /etc/bashrc file.  I then saved the file and sourced it with ". ./.bashrc" to test the settings and ensure I didn't break anything.  Cool, all looked to be fine.  I closed the window, opened another one and that is when I noticed that the changes I made were non-existent.

So, I did a little bit of Google digging and quickly learned that by default, OSx looks for the .bash_profile, not the .bashrc file.  That is a bit of a change from Linux as it does look for the .bashrc.  To not look for it is a bit ludicrous in my opinion (as rc files are the most common settings files in the *nix world), but this is not a standard *nix platform.  So, I did what any geek would do and created a soft link for .bash_profile that pointed to my .bashrc that I had just created.  Yes, I just created it and was going to be damned if Apple was going to tell me I couldn't use it.  Call me stubborn, but its my environment, not theirs.

So, after that little speed bump, I need only edit my .bashrc and resource to have my changes take effect.  Now, on to see what other funky differences I can discover.
 
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.