De Tout Et De Rien

To content | To menu | To search

Tag - Mac OS X

Entries feed - Comments feed

Thursday, November 13 2008

<mkbundle/> task in Monobjc

Many people want to package their .NET application for Mac OS X. And above all, they want the experience to be painless, which means that they want to ship an application that runs, whether Mono is installed or not.

The process of packaging a .NET application for Mac OS X basically follows 4 steps:

  • Getting .NET dependencies of the .NET executable
  • Generating a native loader that will embed all the .NET assemblies (.NET executable and .NET dependencies)
  • Getting native dependencies of the native executable
  • Relocating all the stuff so library loading goes well

The process can be even more complicated if you are using reflection, dynamically discovered library and so on. So let's keep thing simple.

Getting .NET dependencies

This is the easy part. You just have to find recursively all the .NET dependencies of the .NET executable. As every .NET assembly contains its references, it is trivial.

Generating a native loader

The native loader generation is simplified by the fact that Mono allows .NET assemblies to be loaded from embedded binary streams. So for every .NET assembly, we generate a binary array and use the magical functions of Mono. If there are configuration files to embed, the process is the same.

Getting native dependencies

Once the native loader is compiled, the otool command can give us all the native dependencies. So we gather all the native library needed to run our application. But on Mac OS X, the dynamic loading is based on paths recorded in each native library. This is the point of the next step.

Relocating all the stuff

This is the tougher part of the packaging. Now that you have all the native dependencies, you must be sure that you only have unique dependencies. Why, because we you gather dependencies, you can find either specific version of a library or compatibility version of a library. Failing to make these reference unique can lead to unexpected behavior (mostly cryptic crashes). That where the otool command is useful as the first line always contains the specific version of a library, even if run against a compatibility version symbolic link. Then the install_name is used to change absolute path to relative path containing the macro @executable_path.

Packaging made easy

All this steps can be tedious and error prone. That's why, in the Monobjc, the packaging is done by a NAnt task: <mkbundle/> (you can find its options on this page). This task can handle most of the need for .NET application packaging in a truly simple way. And as a bonus, this task is not linked to the Monobjc bridge, so you can use it even if you don't use the Monobjc bridge.

Wednesday, September 17 2008

VMWare Fusion 2.0 is out, and it goes fast

I am a long term fan of VMWare Fusion, and I have followed with interest the various beta of VMWare Fusion. Today, I have installed the 2.0 final release, and I immediatly see that something has changed. Things seems to go faster, snappier and slicker. So, if you own a Mac and wants to go into the desktop virtualization world, try out VMWare Fusion.

Sunday, September 14 2008

Future of Monobjc

Monobjc is more than one year old, and the time has come to go beyond the Monobjc bridge. In order to develop the .NET programming on Mac OS X, a bridge is not enough. A whole development ecosystem is needed, so any new developer will have all the necessary tools to leverage the power of .NET on Mac OS X. I have identified several tools needed when developing applications:

  • IDE: An IDE is great as it speeds up the edition on multiple document and centralized the application development (code writing, compilation and packaging). Unfortunatly, an IDE is a very complex machinery. Identified solutions: fork SharpDevelop or MonoDevelop.
  • Reflector: A tool like Red Gate Reflector is useful when dealing with assemblies. The though part is to write the IL reverse-engineering engine. Identified solution: a Reflector clone based on Mono Cecil.
  • Obfuscator: When distributing applications, obfuscation is an additional mesaure to protect your investment. Identified solution: an obfuscation tool based on Mono Cecil.

The ecosystem can also be completed by libraries either based on Mac OS X framework (Sparkle, Growl, ...) or existing .NET libraries. Stay tuned as now, the goals for Monobjc are clear.

Wednesday, September 10 2008

Migrating from CocoaSharp to Monobjc

If you are using CocoaSharp and you want to migrate to Monobjc, read this tutorial. It contains tip and tricks to ease the migration.

Monday, August 11 2008

Raytracing with Mono on Mac OS X

A while ago, Luke Hoban implemented a ray-tracing sample application. I have made a Cocoa port of this application by using the Monobjc bridge, and it was over in less than one hour. Here is a screenshot:

Ray Tracer Application in Cocoa

You can download the source code as part of Monobjc.

Friday, February 15 2008

Time Machine Icon in Menu Bar

Since Mac OS X 10.5.2, there is a Time Machine Icon in the Menu Bar. Have you ever noticed that when a backup is in progress, the icon's clock goes backward ?

Wednesday, November 21 2007

What I really like about Mac OS X 10.5 (Leopard)

I recently successfully upgrade my MacBook to the new version of Mac OS X, also known as Leopard. After one hour, I had a ready to go system, without any problem.

I think Leopard is a great upgrade especially for:

  • The Finder is now very smart and responsive. The search is amazingly fast and QuickLook is very handy, especially on text documents and images.
  • Time Machine is one of the killer feature that makes backup a breeze. The initial backup is pretty long, but after that, it is very stealth. and the Time Machine animations are REALLY cool.
  • Spaces is very handy, and its integration is nicely done. Moving a window from a space to another space is simply as dragging and dropping .Maybe, an permanent overview of the spaces will be neat.
  • In Terminal, you can now have tabs, which reduces the screen pollution. Another feature long seen before in Linux.
  • And what I like, is that EVERYTHING seems to go faster than in Tiger. It is totally subjective.

So, my piece of advice is go and get it.

Tuesday, November 13 2007

Change the large size of dock icons

While testing the glass effect on the MacOS Dock on Leopard, I was suprised to see a curious parameter in com.apple.dock.plist. It is related to the large size of the dock icons when magnification is enabled. The preferences pane let you set this value to 128 at most, but you can put arbitrary value in the plist file.

defaults write com.apple.dock largesize -int 256
killall Dock

And your dock will show bigger icons. To revert to a normal size, open the Dock Preferences Pane.

Saturday, July 29 2006

Playing Windows Media Files with QuickTime player on Mac OS X

When you wanted to play Windows Media Files on MacOS X, the choice was pretty simple : use Windows Media Player for MacOS X.

But now, there is an alternate solution : you can now play Windows Media Files with Quicktime, thanks to the Windows Media Components for QuickTime. The components are based on the Flip4Mac engine and allow playing of the most of the Windows formats.

Tuesday, May 16 2006

JDK 1.5 source code under Eclipse on MacOS X

There is one thing pretty annoying with the Apple Java Development Kit : you don't have access to the source code under . Why ? Simply because doesn't ship it with the JDK and therefore Eclipse cannot discover it. So, what can I do if I want to have the source code linked to the JRE library as it is done automatically under Windows ?

Update 2006-05-20 : Thanks to Cedrik Lime (see the first comment), here is a very simple solution :

  • Go to the Apple Developer Connection, in the downloads page.
  • Download the J2SE 5.0 Release 4 Developer Documentation package. You may have to log on the ADC. Registration is free if you don't have an account.
  • Once downloaded, install it.
  • In Eclipse, go to Window menu and open the Preferences... dialog.
  • Go to Java/Installed JRE panel. You should see a list of the currently detected MacOS X JVMs.
  • Click on the Add... button to add a new JRE definition.
  • Type JDK 1.5.0 in the JRE name field (or whatever you want).
  • Click on the Browse... button and selec the /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home folder.
  • A list a jars must show up. A part of them should have them source attachement filed.
  • Click on the Ok button.
  • Click on the Ok button.

That's it. You have an Eclipse that can show you the JDK source code when you need it. Of course, you don't have access to all the source because, doesn't ship all the JDK source code.