Your system has run out of application memory

I am using Apple MacBooks and macOS since 2010y I have been pleased all almost all the time.

However, I have never encountered something like “Your system has run out of application memory”, I think. Until I upgraded to macOS Catalina 10.15.1

I run a machine with 8GB of RAM. I wonder where the OS consumes 7.5 GB of RAM though.

Something worth a “screenshot” to remember…

fzf – Command-line Fuzzy Finder on macOS X

If you master your Terminal it always looks like you are a superhero. Therefore, I always try to present a lot using terminal during my lecture, just to provide some smoke and mirrors.

However, I am far away from mastering Terminal truly. Therefore, it comes in handy that one of my students pointed me to reverse-i-search which is available on Terminal.

Wich this reverse lookup you can search through previous commands used in Terminal before. While this is an awesome feature you can activate by control-r on macOS, it does not allow you to search for similar commands used before. It always shows just exact matches of what you typed.

reverse-i-search on macOS

To search through similar typed commands, you can use fzf, a command-line fuzzy finder available at GitHub.

It’s an interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc.

Installing on macOS using Homebrew

For your convenience you can install fzf using Homebrew using the command

brew install fzf 

For me, the bash integration was not available after the installation. After some investigation (I might haven’t read the instruction well enough), I realized the installation script needs to be run:

/usr/local/opt/fzf/install

Eventually, the installation routines put [ -f ~/.fzf.bash ] && source ~/.fzf.bash into .bashrc. I run into this issue some time before. Reading through this article on Scripting OS X might give you an idea why it does not run.

When you open a terminal application, it does not ask for login. You will just get a command prompt. In other versions of Unix or Linux, this will not run the .bash_profile but a different file .bashrc. The underlying idea is that the .bash_profile should be run only once when you login, and the .bashrc for every new interactive shell.

However, Terminal.app on macOS, does not follow this convention. When Terminal.app opens a new window, it will run .bash_profile. Not, as users familiar with other Unix systems would expect.bashrc.

Moving the line mentioned above into .bash_profile and deleting .bashrc eventually solved the issue. After restarting Terminal the key bindings CTRL-R and CTRL-T have been available as expected.

fzf command-line fuzzy search

With this little trick the installations of fzf works quite well on macOS X Mojave.

tl;dr

Use reverse-i-search by pressing control-r on macOS to search previous commands typed in Terminal. In addition, you can use fzf, a command-line fuzzy finder to find similar commands and all other kinds of stuff.

To install run

  • brew install fzf
  • /usr/local/opt/fzf/install
  • copy [ -f ~/.fzf.bash ] && source ~/.fzf.bash from .bashrc into ~/.bash_profile (and remove .bashrc if not needed) or source .basrc from .bash_profile

Link: https://github.com/junegunn/fzf

The Right Moment to start over with Visual Studio and .NET

Yesterday, Somasegar, corporate vice president of the Developer Division at Microsoft announced Microsoft is going to open source the .NET platform. Since I left Microsoft in 2011, this is one of the moments I am most stunned. There is a fully featured community edition of Visual Studio, Android emulator, .NET open sourced under the MIT License, support for Linux and Mac OS X. Further background information can be found on my former colleague Immo’s post over here.

I went from Windows to Mac once I left, dug into Python, Java, a lot of Apache projects and somewhat C++ and JavaScript, developing for the new Jolla and Sailfish OS and contributing to the IoT project  OpenHAB. Anyway, I never really was that overwhelmed by the dev ecosystem as I was with Microsoft.

It does not look like the Microsoft I left at all, however, with these major changes, I will be definitely one of the first nailing .NET on my Mac OS X.  I am looking forward for this. For today, I will install the new Visual Studio Community 2013 on my virtual Windows, though.

Check and Fix the Shellshock Exploit on Mac OS X

Since I switched to Mac in 2011, I do not keep that much track of vulnerabilities as I did running Windows as my main system. However, the recently announces Shellshock exploit got my attention. As Apple has no patch in place by today, I went for a manual path of the bash shell. Only precondition is Apple’s Xcode being installed on your system.

First, checking whether your  system is vulnerable, you simply need the following bash script being run:

env x='() { :;}; echo not' bash -c 'echo safe'

In my case, unfortunately, I got a

not
safe

on my shell, running Mac OS X 10.9.4. Checking the version is simple done as following:

bash --version
GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)
Copyright (C) 2007 Free Software Foundation, Inc.

In case you passed the check, you should run a second one, as since Thursday, there is a second attack vector knwon

env X='(){(a)=>\' bash -c "echo date"; cat echo; rm -f echo

The good news, not vulnerability from this vector.

date
cat: echo: No such file or directory

In case one would get the current date and time, there would be vulnerability, too.

As there is no patch from Apple right now, there is an possibility to build an update manually from the GNU repositories.

mkdir bash-fix
cd bash-fix
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf -
cd bash-92/bash-3.2
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0
cd ..
sudo xcodebuild

In case you are vulnerable to the second vector, there is a another path to be applied:

mv build/bash.build/Release/bash.build/DerivedSources/y.tab.* bash-3.2/
cd bash-3.2
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0
cd ..
sudo xcodebuild

By running

bash-fix/bash-92/build/release/bash --version 
bash-fix/bash-92/build/release/sh --version

you should be able to verify the version of the fix.

GNU bash, version 3.2.52(1)-release (x86_64-apple-darwin13)
Copyright (C) 2007 Free Software Foundation, Inc.

Before replacing the old version, I backup the original bits.

sudo cp /bin/bash /bin/bash.3.2.51.bak
sudo cp /bin/sh /bin/sh.3.2.51.bak

Now you can replace the original ones by

sudo cp bash-fix/bash-92/build/Release/bash /bin
sudo cp bash-fix/bash-92/build/Release/sh /bin

Once this is done, you can check for the exploit again

env x='() { :;}; echo not' bash -c 'echo safe'
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
safe

Once verified, you can get rid of the bash-fix folder and your system should be safe from this exploit.

 

Wiping all your iPhone’s Photos

Since iOS 7, the possibility to wipe your entire camera roll in iPhone has gone for good. In case you have  a lot of photos on your devices, deleting all of them might be quite an elaborate job to do.

To make it quick, there is still a possibility, if you have your Mac at hand. Connect your iPhone and start Image Capture which comes with your Mac OS X.

Image CaptureMake sure to select your iPhone on the right hand list, select all (⌘+a) photos from your device and press the delete bottom located at the bottom of Image Capture.

Deleting...Depending on the number of photos on your device this might take some time.

Make sure to import your photos beforehand either using Image Capture as well or some synchronization such as Dropbox’s Image Upload.

 

Revolutionary becomes Evolutionary

Recently, I discussed a lot with friends and colleagues about new mobile devices. Using Windows Mobile for years, I switched to Apple’s iPhone 3GS three years ago. Before, I talked quite a lot with a friend who recently bought one at that time.

Before, I used an iPod for listening to music and Windows Mobile devices such as the HTC Hermes or the HTC Touch Pro for quite a few years. Over time, I got annoyed by always carrying two devices, two power plugs, two connector cables and by managing at least two different applications to sync both devices. Eventually, my decision to buy an iPhone was driven by quite rational thoughts.

I was pleased with the hardware quite a lot, never worried about the processor, ram or other components of the device. The only drawback for me as an developer was the fact that you cannot simply deploy your home brewed application to the device.

I skipped two generations of the iPhone, finally rethinking of getting a new device. What shall it be? Meanwhile, I am quite off the track developing for Windows Mobile. Also, the hardware fragmentation for Windows devices is quite a bit. Similar situation with Android based devices. Which one is the reference hardware to buy? While the idea of developing for the Android platform is tempting, there are more facts to consider.

After three years, I have to admitt, the ecosystem lock in is quite a reason. IPad (first gen but with 3G), an almost retina but bought a few months to early MacBook and quite a lot of periphery to use with my devices is a good reason to stay. Nevertheless, with the new Lightning connector many peripheral devices became obsolete.

Much more than the hardware lock in is definitely a data lock in. Dozens of apps with your data, synced address books and calendars, lifelogging and quantified self data collected over the years is a good reason to stay with the current platform.

With the release of the new iPhone there is a lot of making-fun-of-the-new-iphone going on, however considering the facts above you see there are simple reasons to stay with a platform. This is definitely a goal of every manufacturers, and Apple plays this this game very well.

Looking at the new hardware, iOS 6 as well as the new Mac OS, there is no rocket science, there is no Star Trek communicator and no universal translator comming with new iPhone. There is no revolution, simply a technological evolution of a long designed system. A system that grew five generations.

Personally, I think a steady evolution of technology is worth quite a lot. I don’t want to migrate all the data, I don’t want to worry about the hardware to buy, I don’t want to learn new user interfaces and usability concepts for now. I want a device being part of my daily (business) life, easy to use, sitting in my pocket being available when needed. With the current evolution of the iPhone this should be possible for the next one or two hardware generations.

Said that, it will be a 64GB iPhone in white for me while it will be a Nokia Lumina 900 or a Google Galaxy Nexus for others due to the same or similar reasons mentioned above.

iPhone 5