Index: uresample.pas
===================================================================
--- uresample.pas	(revision 6102)
+++ uresample.pas	(working copy)
@@ -391,7 +391,11 @@
     else
       SrcIntfImage := TLazIntfImage.Create(Src.RawImage, False);
     DstIntfImage := TLazIntfImage.Create(Dst.RawImage, False);
+    {$IFDEF Darwin}
+    ImgFormatDescription.Init_BPP32_A8R8G8B8_BIO_TTB(DstWidth, DstHeight);
+    {$ELSE}
     ImgFormatDescription.Init_BPP32_B8G8R8A8_BIO_TTB(DstWidth, DstHeight);
+    {$ENDIF}
     DstIntfImage.DataDescription := ImgFormatDescription;
 {++++++++++++++++++++}
 
Index: platform/upixmapmanager.pas
===================================================================
--- platform/upixmapmanager.pas	(revision 6102)
+++ platform/upixmapmanager.pas	(working copy)
@@ -1068,6 +1068,8 @@
   Result:= GetMimeIcon(FileType, gIconsSize);
 end;
 
+//{$DEFINE USE_TIFF}  // ... when it's fixed in lazarus/fpc
+{$DEFINE USE_BMP}
 function TPixMapManager.GetMimeIcon(AFileExt: String; AIconSize: Integer): PtrInt;
 var
   I: Integer;
@@ -1076,26 +1078,67 @@
   nRepresentations: NSArray;
   nImageRep: NSImageRep;
   WorkStream: TBlobStream;
-  tfBitmap: TTiffImage;
+  tfBitmap: TFPImageBitmap;
   bmBitmap: TBitmap;
+  bmpRep: NSBitmapImageRep;
+  bestRect: NSRect;
+  aImage, cImage: NSImage;
 begin
   Result:= -1;
   if not FUseSystemTheme then Exit;
   nImage:= NSWorkspace.sharedWorkspace.iconForFileType(NSSTR(PChar(AFileExt)));
-  nRepresentations:= nImage.Representations;
   if AIconSize = 22 then AIconSize:= 32;
-  for I:= nRepresentations.Count - 1 downto 0 do
-  begin
-    nImageRep:= NSImageRep(nRepresentations.objectAtIndex(I));
-    if (AIconSize <> nImageRep.Size.Width) then
-      nImage.removeRepresentation(nImageRep);
-  end;
-  if nImage.Representations.Count = 0 then Exit;
-  nData:= nImage.TIFFRepresentation;
+
+  // try to find best representation for requested icon size
+  bestRect.origin.x:= 0;
+  bestRect.origin.y:= 0;
+  bestRect.size.width:= AIconSize;
+  bestRect.size.height:= AIconSize;
+  nImageRep:= nImage.bestRepresentationForRect_context_hints(bestRect, nil, nil);
+  if nImageRep<>nil then
+    begin
+      cImage:= NSImage.Alloc.InitWithSize(nImageRep.Size);
+      cImage.AddRepresentation(nImageRep);
+      aImage:= cImage;
+    end
+  else
+    begin
+      // try old method
+      cImage:= nil;
+      nRepresentations:= nImage.Representations;
+      for I:= nRepresentations.Count - 1 downto 0 do
+      begin
+        nImageRep:= NSImageRep(nRepresentations.objectAtIndex(I));
+        if (AIconSize <> nImageRep.Size.Width) then
+          nImage.removeRepresentation(nImageRep);
+      end;
+      if nImage.Representations.Count = 0 then Exit;
+      aImage:= nImage;
+    end;
+
+  nData:= aImage.TIFFRepresentation;
+  {$IFDEF USE_BMP}
+  bmpRep:= NSBitmapImageRep.imageRepWithData(nData);
+  nData:= bmpRep.representationUsingType_properties(NSBMPFileType, nil);
+  tfBitmap:= TBitmap.Create;
+  {$ENDIF}
+  {$IFDEF USE_TIFF}
   tfBitmap:= TTiffImage.Create;
+  {$ENDIF}
+
   WorkStream:= TBlobStream.Create(nData.Bytes, nData.Length);
   try
-    tfBitmap.LoadFromStream(WorkStream);
+    try
+      tfBitmap.LoadFromStream(WorkStream);
+    except
+      // just in case ...
+      tfBitmap.free;
+      tfBitmap:= nil;
+      exit;
+    end;
+    {$IFDEF USE_BMP}
+    Result:= FPixmapList.Add(tfBitmap);
+    {$ELSE}
     bmBitmap:= TBitmap.Create;
     try
       bmBitmap.Assign(tfBitmap);
@@ -1103,8 +1146,13 @@
     except
       bmBitmap.Free;
     end;
+    {$ENDIF}
   finally
+    {$IFNDEF USE_BMP}
     tfBitmap.Free;
+    {$ENDIF}
+    if cImage<>nil then
+      cImage.Release;
     WorkStream.Free;
   end;
 end;
