DenisSergeevitch/desktop-fly: A 3D fruit fly living on your macOS desktop, driven by a live spiking simulation of the real FlyWire connectome

DenisSergeevitch/desktop-fly: A 3D fruit fly living on your macOS desktop, driven by a live spiking simulation of the real FlyWire connectome

In This Article

    Desktop-Fly: Put a Connectome-Powered Fruit Fly on Your Mac

    Imagine a 3D fruit fly wandering across your macOS desktop. It grooms its legs, walks in short bursts, and pauses as if deciding what to do next. But this isn't a scripted animation—it's a living spiking neural network simulation running in real time, based on the complete wiring diagram of an adult fruit fly brain.

    Key takeaway: Desktop-fly is an open-source macOS app that runs a 130,000-neuron connectome simulation on consumer hardware. You can install it in minutes and watch emergent behavior arise from neural activity—no animation scripts involved.

    What Is Desktop-Fly?

    Created by Denis Sergeevitch, desktop-fly renders a 3D fruit fly using Apple's Metal API. The fly's movements—walking, grooming, antenna cleaning—aren't pre-programmed. Instead, they emerge from a leaky integrate-and-fire (LIF) spiking neural network that simulates the FlyWire connectome.

    The FlyWire connectome is the first complete wiring diagram of an adult Drosophila melanogaster brain, published in 2023 by a consortium led by Princeton and Cambridge. It contains approximately 130,000 neurons and 50 million synapses, reconstructed from 21 million electron microscopy images.

    The simulation processes roughly 1 million synaptic events per second on Apple Silicon, running at 60 fps on M1 and later chips.

    Why It Matters

    This isn't a toy. Desktop-fly is the first real-time connectome simulation running on consumer hardware. The neural computation runs on the CPU or GPU, with optional Apple Neural Engine (ANE) acceleration on M-series chips.

    For researchers and students, it's a hands-on tool for exploring neural coding. You can tweak synaptic weights and watch behavior shift in real time. For developers, it's a working example of neuromorphic computing principles applied to everyday devices.

    Quick Setup Guide

    Requirements: macOS with Apple Silicon (M1 or later) for best performance. Intel Macs will run it, but expect lower frame rates.

    1. Clone the repository: bash git clone https://github.com/DenisSergeevitch/desktop-fly.git

    2. Open in Xcode: Navigate to the project folder and open the .xcodeproj file.

    3. Set your signing team: In Xcode, go to Signing & Capabilities and select your development team. This is required for local execution.

    4. Build and run: Hit Cmd+R. The fly should appear on your desktop within seconds.

    Tip: If you're on an Intel Mac, use a discrete GPU if available. The simulation will run, but don't expect 60 fps.

    How to Use and Customize

    The app ships with a real-time neural activity visualization. Toggle it on to see spikes and synaptic currents flowing through the network—it's like watching the fly think.

    Customization options:

    • Neuron thresholds: Modify the firing threshold in the LIF model to make neurons more or less excitable.
    • Synaptic weights: Change connection strengths to see how behavior shifts.
    • Noise parameters: The simulation includes stochastic noise. Adjust it to make the fly more erratic or more deliberate.

    Each fly is unique due to random initialization. Two flies running simultaneously will behave differently even with identical parameters.

    Performance Tips

    • Enable ANE acceleration on M-series chips. This offloads matrix operations and frees the GPU for rendering.
    • Close heavy apps (browsers, video editors) to maintain 60 fps.
    • Reduce neuron count if you see lag. The config file lets you simulate a subset of the connectome—useful for testing on older hardware.

    FAQ

    What is desktop-fly? An open-source macOS app that places a 3D fruit fly on your desktop, animated by a live spiking neural network simulation based on the FlyWire connectome.

    How does the simulation work? It uses a leaky integrate-and-fire neuron model running on Metal Performance Shaders. The fly's behavior emerges from neural activity—there's no animation scripting.

    Do I need a powerful Mac to run it? Apple Silicon (M1 or later) is recommended for smooth 60 fps performance. Intel Macs can run it but may struggle with full connectome simulation.

    Can I customize the fly's behavior? Yes. You can modify neuron thresholds, synaptic weights, and noise parameters in the source code. Changes take effect immediately.

    Is the fly's behavior deterministic? No. Random initialization and stochastic noise make each fly unique. Even the same fly behaves differently across runs.

    How can I install desktop-fly? Clone the GitHub repository, open it in Xcode, set your signing team, and run. No third-party dependencies are required.


    Ready to bring a connectome-powered fly to your desktop? Visit the GitHub repository at https://github.com/DenisSergeevitch/desktop-fly to get started, and don't forget to star the project if you find it fascinating. This is a stepping stone to more complex brain simulations on everyday devices—and it's running right now on machines like yours.

    N
    Nina Okonkwo
    Technical Educator
    Taught 10,000+ students to code through bootcamps and online courses. Believes every skill can be taught if you break it down right. Based in Nairobi.

    📬 Get new articles by email

    No spam. Just new articles from Practical Guides.