Skip to content

Posts from the ‘Mac’ Category

29
Oct

Mac, Lion and the Lost Installer

Imagine you have an older Mac (like my Mac Book Pro 15” from 2005), you have Lion installed (last OS that it takes) and then you want to give this one to someone else.
Now the first thing that you for sure want to do is to erase the entire content of your hard disk and then re-install Lion from scratch to be sure that the new owner does not have access to your data.
If you have a Lion Installer Thumb Drive you can now reboot your Mac while holding the Option key. Then you select the ER Built (USB Icon) drive.
After the Installer comes up you can go to the Tools menu section, select the Disk Utility and format your boot drive. After this is done restart, hold the Option key and select again the Installer Thumb Drive.

Problem

If you were unlucky like I was then you will see a dialog that says:

There was a problem installing Mac OS X. Try reinstalling

What the ….?

First I thought the thumb drive is bad, then I doubled checked that both the Thumb Drive and the Mac’s boot drive are OK. Finally, just before giving up, I googled the problem and found an Apple Discussion that discussed the problem and had a solution.

Solution

It turns out that I had to reset the PRAM in order to be able to Install Lion again. As much as I love the ease of use of OS X sometimes it comes with a huge price tag. I would never have thought of this and I was spending a considerable amount of time to try to resolve it before I searched the Internet. It would have been nice if the Mac could give a hint of what is the problem and not just displays this somewhat useless Dialog.
Especially considering that this is rare but still possible scenario for a regular Mac user.

At least I got passed that issue and could installed Lion again.

Cheers – Andy

19
Aug

Pelican: Another Way for Madplanet.com Inc. Site?

Lately Bluehost.com gives me some grief and so I am thinking about changing my provider.
So I started to think that maybe this would be a good opportunity to also switch from WordPress to an easier setup.
What I would like to do is to use Markup to write by posts and pages but also wanted to see
if it is possible to avoid having to deal with a DB. Not that I hate to use a DB but backing
up the data and exporting the content is not that simple. But then again what should I use and is it ready worth the effort.

Then I found this page from [http://www.macdrifter.com/2012/08/pelican-guide-moving-from-wordpress-and-initial-setup.html|Macdrifter] talking about Pelican which would just do that.
But instead of plunging right into it I wanted to do an intermediary step by having the Site
first running on my local Mac (Apache, Python already there) and when it is working as expected
I will go ahead and push the content from my Mac to the ISP.

First step was to just get Pelican installed and up and running before going ahead.
Afterwards I would recreate Madplanet.com’s website on my local Mac so that I don’t have
to bother my ISP or damage the installation. From there I will migrate the content over
and when it is done I will push the content out and pull the plug on the old site.

Pelican Installation

To my surprise the installation and configuration of Pelican was straight forward:

sudo -s
easy_install markdown
easy_install pelican
easy_install pygments

mkdir /Library/WebServer/Documents/pelican

pelican-quickstart

Now don’t waste too much time on the questions. Just answer what you can and leave the rest
blank or accept the defaults. It is only generating a configuration file for most parts.

The only important thing is that the location for pelican is at the previously created
directory (/Library/WebServer/Documents/pelican). You can select any directory you
like but this is the default given by Apple and so I used this.

Apache configuration

The Apache Configuration can be different on every computer and so here I only describe
the simplest solution to set Pelican to be the root document root. For that I just set
the Apache Document Root to the Pelican’s Output directory:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents/pelican/output"

and then define that Directory:

<Directory "/Library/WebServer/Documents/pelican/output">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks MultiViews

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

Last two steps are to check if the configuration is OK and then restart the Apache server:

sudo apachectl -t
sudo apachectl restart

See Pelican in Action

Before we can go ahead we need to generate the site in Pelican. For that we go to the
project’s home directory (/Library/WebServer/Documents/pelican) and use make to generate
the site:

cd /Library/WebServer/Documents/pelican
make pelican

Finally we can open the site with this url: localhost.

Conclusion

I am not done here by a long shot. First I need to have both the WordPress and the Pelican
site running on my Apache Server and then I need to export my WordPress site and install it
locally. But for now that’s all.

– Andy

5
Aug

Annotate Screenshots in Mountain Lion is Super Easy

I often have to create documentation with screenshots of web pages or applications. In order to make it easier for a reader to focus on what is important I want to annotate the image with ovals, rectangles or text. So far this was not very easy but by pure luck I figured out a quit fast and easy solution which does not to require to create temporary files.

These are the steps:

  1. Create a screenshot to the clipboard (Shift-Control-Command-4) and optionally you can then hit the spacebar to select a window
  2. Go to Preview (open it if not yet done)
  3. Create new document (Command-N) => the image from the clipboard is placed automatically into the window
  4. Annotate (like Control-Command-R) the image
  5. If needed select all (Command-A)
  6. Copy the image (Command-C)
  7. Go to the target App (Nisus Writer, Pages etc)
  8. Paste the image (Command-V)

The only annoying step is that I have to “delete” the image in Preview afterwards but that can be done at the end.

 

I can also copy an image from the target document or from another source like Safari etc.

 

Happy documenting – Andy

8
Feb

Mac OS X Tip: Manage Screenshots with DEVONthing

Since a while I am thinking on how to manage screenshots the best. I take them but then are lurking around inside a directory and if I don’t head over, review and rename them I will loose the context and often they become worthless. What I want is to take a series of screenshots (for example to demonstrate how to do something), then review and rename them quickly.
Because I am using DEVONthink as my second brain where I just dump everything I need to keep an eye on or need to work on later and then use its search / quick preview feature to go over the entries and organize them correctly. The nice think about DEVONthink is that it has a directory for its Inbox in the file system that I can use to drop items there using Finder or any other file selection tool.
Now I started to think if it would be possible to use the Mac Screen Capture system to add these screenshots to DEVONthink so that I can review them, add tags and organize them correctly after I am done with taking the shots. So I followed the instruction from Mac World OS X Hints how to change the default location for screenshots and opened a terminal:

defaults write com.apple.screencapture location \
    "/Users/<User Name>/Library/Application Support/DEVONthink Pro 2/Inbox"

Then I had to log out and log back in so that the change could take into effect.
Now when I take a screenshot it won’t appear on the Desktop but rather in the Inbox of DEVONthink where I can easily view them, add tags and copy them into the final destination.
– Andy

10
Aug

Wrong Mac OS X Lion’s App Store Purchase List

During my migration to Lion using multiple installation on my Mac Pro using different hard disks. This had some wired side effects on the App Store because Lion is using Spotlight to find installed Apps and is not limited to the boot disk but rather takes all attached disks. This let to a wrong Purchase list in the App Store. For example I had Daisy Disk installed on my first Lion installation but on my current installation I did not. Now the App Store would report the App as installed and so I could not install anymore. The bad thing was that I could not just copy over the App from the other Lion installation because DaisyDisk needed some additional libraries which are only installed during the installation process (I guess).

The trick to fix it is to the following:

  1. Open System Preferences
  2. Select Spotlight
  3. Click on the Privacy tab
  4. Add all partition that have App Store Apps installed on it to this list

This is how it could look like:

As far as I can tell you can remove the partition from this list again as soon as you installed the Apps but your milage might vary.

System Preferences Spotlight Privacy

BTW, I also noticed that any partition with Apps from the App Store will interfere with your purchase list even if that partition is a Snow Leopard installation.

– Andy

6
Aug

AgileBits’ KnoX Sucks, Don’t Buy It

A while ago I heard about Know from AgileBits and it seemed to be a good idea where I could encrypt a directory so that it could only be mounted by Knox and one could read it only through Knox. This meant that I could place my sensitive data into that directory and nobody could read them w/o having the password. Because Knox is made by the same company (AgileBits) than 1Password I naturally expected that I could place the password for Knox inside 1Password and I would only need my 1Password master password to open it. Unfortunately AgileBits was unable just to do that. So I paid $35 bucks for nothing. The only place where it would be useful is when I have a directory with sensitive data that is use rarely. If I need to remember the password in order to automatically open the encrypted folder on startup then the idea of Knox is gone.

Now with the Full Disk Encryption of Mac OS X Lion any incentive for AgileBits is gone too making the App obsolete in most cases. The only place where I would to have it is for the rarely used but highly sensitive data like credit reports etc. That said it might be a better solution to use an additional disk (external or internal) and use Full Disk Encryption on it. This way the encryption is tightly integrated into Mac OS X Lion with no fuss. Therefore Knox because the first casualty migrating to Lion. Too bad – too sad. If it weren’t for 1Password I would never use or buy any application from AgileBits.

– Andy

6
Aug

Using Embedded Lion Server PostgreSQL Database

One of the new features of Mac OS X Lion Server is that Apple replaced MySQL with PostgreSQL as internal database server. The drawback is that it is not easy accessible by default. Here I want to show you what to do and how you can manage it.

Attention: if you want to use the PostgreSQL server from EnterpriseDB then I would strongly recommend to make a backup of your server because if it fails the uninstallation might corrupt your embedded PostgreSQL server. Yesterday, August 4th 2011, I installed Enterprise DB’s server and because it did not start I uninstall it but then my embedded server was corrupted as well. Now this might be just an issue with the startup script but nevertheless I lost the DB. It seems that the installation from Enterprise DB is not compatible with Lion and so I wouldn’t use until they provide one that is. Their own recommendation is to use the embedded server instead.

When you installed the Lion Server then you can use ps -ef in order to see if PostgreSQL is running:

bash-3.2# ps -ef | grep post
216   468     1   0  8:33AM ??         0:00.13 /usr/bin/postgres -D /var/pgsql -c listen_addresses= -c log_connections=on -c log_directory=/Library/Logs -c log_filename=PostgreSQL.log -c log_lock_waits=on -c log_statement=ddl -c log_line_prefix=%t  -c logging_collector=on -c unix_socket_directory=/var/pgsql_socket -c unix_socket_group=_postgres -c unix_socket_permissions=0770

You can get some more information about the service with that:

sudo serveradmin list
...
pcastlibrary
postgres
radius
...

and some more details:

sudo serveradmin fullstatus postgres
postgres:dataDirHasBeenInitialized = yes
postgres:PG_VERSION = "9.0.4"
postgres:dataDir = "/var/pgsql"
postgres:postgresIsResponding = yes
postgres:dataDirIsDirectory = yes
postgres:PGserverVersion = 90004
postgres:dataDirExists = yes
postgres:setStateVersion = 1
postgres:state = "RUNNING"

So far so good. Now if we try to connect to the DB using telnet:

telnet localhost 5432

we see that there is no socket listening which means that PGAdmin cannot be used to administer the server nor can it be used by a JDBC driver. If you look above in the process description you will see an option called listen_addresses which is empty. Maybe if we could set our server address there we might be able to connect.

Initially I found the original PostgreSQL server configuration file under /var/pgsql/postgresql.conf but that did not do the trick. Knowing a little bit about Mac internals I started to look for a file inside /System/Library with the name postgres in it. So I found the file: /System/Library/LaunchDaemons/org.postgresql.postgres.plist. This file has an array of properties including the listen addresses:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Disabled</key>
	<true/>
	<key>GroupName</key>
	<string>_postgres</string>
	<key>Label</key>
	<string>org.postgresql.postgres</string>
	<key>OnDemand</key>
	<false/>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/bin/postgres</string>
		<string>-D</string>
		<string>/var/pgsql</string>
		<string>-c</string>
		<string>listen_addresses=</string>
		<string>-c</string>
		<string>log_connections=on</string>
		<string>-c</string>
		<string>log_directory=/Library/Logs</string>
		<string>-c</string>
		<string>log_filename=PostgreSQL.log</string>
		<string>-c</string>
		<string>log_lock_waits=on</string>
		<string>-c</string>
		<string>log_statement=ddl</string>
		<string>-c</string>
		<string>log_line_prefix=%t </string>
		<string>-c</string>
		<string>logging_collector=on</string>
		<string>-c</string>
		<string>unix_socket_directory=/var/pgsql_socket</string>
		<string>-c</string>
		<string>unix_socket_group=_postgres</string>
		<string>-c</string>
		<string>unix_socket_permissions=0770</string>
	</array>
	<key>UserName</key>
	<string>_postgres</string>
</dict>
</plist>

Adding our IP address there:

listen_addresses=127.0.0.1

saving the file and restarting the server:

sudo serveradmin stop postgres
sudo serveradmin start postgres

did the trick. Now I could download and install PGAdmin and connect to the server using the user _postgres and my password (the original administrator):

PGAdmin with Local PostgreSQL.png

Cheers – Andy Schaefer

30
Jul

Upgrade my Mac OS X Server to Lion

Attention: this blog entry is in reverse order meaning the task started at the bottom and I’ll add updates on top of it

Fri Aug 12: Today wa the day where I pulled the plug from our Snow Leopard server taking it from the Internet. I did that to make sure that any new mails sent will not be received until the migration is done otherwise I might loose some of the emails. Then I also wanted to make sure that I don’t loose any changes to the web sites like comments etc.

So after the Server was taken from the Internet I exported the Mail DBs, the MySQl (WordPress) and PostgreSQL (XWiki) DBs and copied them onto another drive. The last step of the preparation was to make a SuperDuper copy and test the copy by booting from it. This way I was sure that I could recover the server in case of big problems and or if I needed to export more data. After I rebooted into the SuperDuper copy I also used it to reformat the original server disk by earsing it with the Disk Utility and then start the Lion installation. It turned out that I still needed an Internet connection but because I have a strange double router setup for the server I was able to connect the server to the Verizon router which prevented the Mac Mini to be identified as server. So I could install Lion and after that was finished the Lion Server and Lion Server Administration tools. After I installed some necessary programs like Dropbox, 1Password, pgAdmin3, MySQL and MySQL Workbench as some others and added the localhost as interface to the embedded PostgreSQL I restarted the box the first time.

The first problems I encountered was some issues with the SSL certificates but eventually I could generated a self-signed certificate and import it to the server. Then I ran into issues with Mail and DNS. Eventually I had to setup DNS step by step. First the local server definition, then the machine, than the aliases etc. And between each step using nslookup to verify everything fine. After all was setup I went ahead and setup the Mail server. Copy over the original Mail DB was that difficult after I figured out that I had to take about all the “.” directories by copying with “cp .*” because a “cp *” would not find and copy the “.” directories. Then I also had to make sure that all files had the ownership “_dovecot:mail” otherwise mail would ignore them. Eventually I got Mail up and running and the old mailboxes copied over. Still there is one thing that doesn’t work. I cannot use SSL with the Mail server and so I can only use Mail inside our home to prevent people from snooping on our mails.

Copying, installing and configuring the web sites was a breeze including the import of the MySQL and PostgreSQL DBs. This was done in less than 2 hours.

There are few things to do like installing Subversion and Subersion server, Gitolite server, Time Machine drive and some file shares but that is purely internal stuff and can be done when needed. Good thing there is that I have a life copy of the server on the SuperDuper backup and so I can check how it was done then and copy necessary files over.

I guess that concludes this post except I ran into some important issues or when I could figure out why Mail doesn’t support SSL for now

.

Tues Aug 9: Yesterday I manage to migrate over my Snow Leopard Mail DBes. It seems that the data structure is compatible and the only thing that I had to adjust is the user (moved to ‘_dovecot’). The rest was just sending one email to myself to create the user DB, then shutdown the mail service and copy over the data. After a restart the mail was available. There was one little thing where sub mail boxes where not handled properly but a many copy of these directories did fix the issue.

Today then I was able to install MySQL (just use 5.5.1 for Snow Leopard) and export / import the PostgreSQL and MySQL databases without any problems. Finally the website were easy as pie. Just tar up the directories in question (Jetty and wordpress), install on Lion Server and restart.

Next step is to actually do the migration. So first take it from the Net (not to loose any mails etc), then backup with SuperDuper, export the Mail DBs and regular Databases and export them onto an external drive. After reformatting the server’s drive I can install Lion, Lion Server, Lion Server Admin tools and the additional programs like Dropbox, 1Password, PathFinder, SuperDuper, MySQL, MySQL Workbench, PgAdmin3 and Java (triggering with ‘java -version’ on command line). After that I need to setup DNS, Mail and Web Sites, import the data and test it. I expect that DNS / Mail to give me some grief (as it always did) but on a late evening / nite shift that should be done. So see you on there other side.

 

Sun Aug 7: I came up with a plan to test the migration and to make sure that I can export / import the DB and Mail data before doing the actual upgrade. So I am taking my laptop, install OS X Lion Server on it and start the migration process. This includes the setup of the server so that it works the same way as my current Snow Leopard server. The only thing that I am going to drop is to use managed clients feature because that wasn’t worth the time I invested into.

I did figure out how to use the embedded PostgreSQL server of the Lion Server and it turned out that I cannot use the installation from Enterprise DB because it doesn’t work and the uninstallation does corrupt the internal PostgreSQL DB. Not good.

This will be a post in progress because the upgrade of the server will take a week or two. As soon as I learned how the OS X Lion Server was distributed I bought the Server App from the App Store. Compared to the original $1,000 (for Leopard) and $500 (for Snow Leopard) this time the server was cheap around $50. So I was ready to test it on one of my developer partion.

The first thing that I saw when I fired up the Sever is that the list of services where limited:OS X Lion Server Window

For me the most important thing was the missing DNS and Open Directory service and the limited functionality for the Web and Mail.  So I went on the Internet to see if I missed some settings or flags but it turned out that one can download the good old OS X Server Admin tools which provides the missing services and the Mail configuration. Still need to figure out how to setup Apache sites I did on Snow Leopard Server. Because I don’t want the server to be down for too long I probably go ahead and use my Laptop and an external drive to create a server clone. When this one is up and running as expected I know what to do. Then I will shutdown the server, install Lion OS and the Server, copy over the necessary data (PostgreSQl DBs, Mail, Web Applications etc) and finally bring the server back to life.

– Andy

25
Jun

GitoLite: Your very own Git Server on Mac OS X Server

GitoLite is a simple Git server that can handle user authentication per project / branch. Even though I don’t mind too much to shell out $300 bucks for a simple business plan with GitHub I want to keep my code closer to my heart that anything else. Even though I don’t think that my server is tightly protected it is at least my fault when something goes wrong. Lately there have been reports of nasty security breaches on user data servers and even Dropbox had their account unprotected for a few hours.

The first thing I was surprised of was the fact that there is no out-of-the-box git server available as it is with Subversion. Then I tried Gitosis but ran into issues with Python and abandoned that. Later I heard about GitoLite which gave me some grief at the beginning but eventually I could make it work out. The trick was to make sure that I was focuses on the task and made sure only to proceed if the previous step worked out.

Update: I copied this documentation to my XWiki.

Read more »

12
Feb

That’s smoking fast

Today I started to work with the CQ from Day (Adobe) and started upload some content. Then I saw this in the Activity Monitor:

Activity Monitor with CPU max out completely

I achieved this by finally started to develop on my Solid State Drive (SSD) which I did not do so far because I had stability issues in the past.

In the past I only saw the system so maxed out when an application was going berserk  but this time the disk is churning along:

Activity Monitor with Disk Activity

Finally it seems that I can take advantage from the SSD and that may also means that I will install one in my Mac Pro desktop machine.

 

Cheers – Andy