Skip to content
Live-Abfahrtszeiten des ÖPNV in München / CLI and Ruby Client for
Find file
Latest commit 060900c @rmoriz Merge pull request #5 from bitdeli-chef/master
Add a Bitdeli Badge to README
Failed to load latest commit information.
bin some cli tweaks
fixtures/vcr_cassettes updated deps + factorygirl
lib drop 1.8.7 support, fixed jruby support
spec updated deps + factorygirl
.gitignore updated dependencies
.travis.yml Update .travis.yml
Gemfile initial push
Gemfile.lock updated deps for development
Guardfile initial push
LICENSE add license & travis Add a Bitdeli badge to README
Rakefile fixed path for spec_helper


A ruby client and CLI for the real-time interface for Munich's public transportation service.

Gem Version Build Status Flattr


gem install mvg-live

If you still use Ruby 1.8.7 or JRuby in Ruby 1.8.7-mode, please use the old version as legacy support was dropped with the 1.0.0 release:

gem install mvg-live --version 0.0.1


require 'mvg/live'

result = MVG::Live.fetch 'Sendlinger Tor'
=> [{:line=>"U7", :destination=>"Westfriedhof", :minutes=>0}, {:line=>"U3", :destination=>"Olympiazentrum", :minutes=>0}, {:line=>"17", :destination=>"Schwanseestraße", :minutes=>0}, {:line=>"U3", :destination=>"Fürstenried West", :minutes=>0}, {:line=>"16", :destination=>"Romanplatz", :minutes=>0}, {:line=>"27", :destination=>"Petuelring", :minutes=>0}, {:line=>"152", :destination=>"Landshuter Allee", :minutes=>1}, {:line=>"U2", :destination=>"Feldmoching", :minutes=>1}, {:line=>"18", :destination=>"Effnerplatz", :minutes=>1}, {:line=>"U1", :destination=>"Olympia-Einkaufsz.", :minutes=>2}, {:line=>"U7", :destination=>"Neuperlach Zentrum", :minutes=>2}, {:line=>"U6", :destination=>"Klinikum Großhadern", :minutes=>2}, {:line=>"U6", :destination=>"Garching-Forschungs.", :minutes=>3}, {:line=>"18", :destination=>"Gondrellplatz", :minutes=>3}, {:line=>"16", :destination=>"St. Emmeram", :minutes=>4}, {:line=>"17", :destination=>"Amalienburgstraße", :minutes=>4}, {:line=>"U3", :destination=>"Moosach", :minutes=>4}, {:line=>"U3", :destination=>"Fürstenried West", :minutes=>5}, {:line=>"U2", :destination=>"Messestadt Ost", :minutes=>5}, {:line=>"U1", :destination=>"Mangfallplatz", :minutes=>6}]

result = MVG::Live.fetch 'Sendlinger Tor', :transports => [ :tram ]
=> [{:line=>"17", :destination=>"Schwanseestraße", :minutes=>0}, {:line=>"16", :destination=>"Romanplatz", :minutes=>1}, {:line=>"27", :destination=>"Petuelring", :minutes=>1}, {:line=>"18", :destination=>"Effnerplatz", :minutes=>2}, {:line=>"18", :destination=>"Gondrellplatz", :minutes=>3}, {:line=>"16", :destination=>"St. Emmeram", :minutes=>4}, {:line=>"17", :destination=>"Amalienburgstraße", :minutes=>5}, {:line=>"16", :destination=>"Romanplatz", :minutes=>8}, {:line=>"17", :destination=>"Schwanseestraße", :minutes=>9}, {:line=>"27", :destination=>"Petuelring", :minutes=>9}, {:line=>"18", :destination=>"Effnerplatz", :minutes=>9}, {:line=>"18", :destination=>"Gondrellplatz", :minutes=>12}, {:line=>"16", :destination=>"St. Emmeram", :minutes=>13}, {:line=>"17", :destination=>"Amalienburgstraße", :minutes=>16}, {:line=>"27", :destination=>"Petuelring", :minutes=>16}, {:line=>"16", :destination=>"Romanplatz", :minutes=>17}, {:line=>"18", :destination=>"Effnerplatz", :minutes=>17}, {:line=>"17", :destination=>"Schwanseestraße", :minutes=>19}, {:line=>"18", :destination=>"Gondrellplatz", :minutes=>22}, {:line=>"16", :destination=>"St. Emmeram", :minutes=>23}]

CLI (command line interface)

This gem provides two scripts:


Returns a human readable listing of the next depatures

$ mvg Hauptbahnhof
$ mvg Marienplatz
$ mvg Moosach Bf.

example output:

Hauptbahnhof: U, Bus, Tram, S
======================================[ 09:03 ]=
19  | Pasing                        |  0 Minuten
16  | Romanplatz                    |  1 Minuten
U2  | Feldmoching                   |  1 Minuten
U1  | Mangfallplatz                 |  1 Minuten
S8  | Herrsching                    |  2 Minuten
U2  | Messestadt Ost                |  3 Minuten
17  | Schwanseestraße               |  3 Minuten
S7  | Aying                         |  4 Minuten
U4  | Arabellapark                  |  4 Minuten
U4  | Theresienwiese                |  5 Minuten
S6  | Ostbahnhof                    |  5 Minuten
U2  | Messestadt Ost                |  6 Minuten
S2  | Petershausen                  |  6 Minuten
20  | Moosach Bf.                   |  6 Minuten
U1  | Olympia - Einkaufszentrum     |  6 Minuten
19  | Pasing                        |  8 Minuten
U5  | Neuperlach Süd                |  8 Minuten
16  | Romanplatz                    |  8 Minuten
U5  | Laimer Platz                  |  9 Minuten
U1  | Mangfallplatz                 | 11 Minuten

displays alternates/suggestions in case of unclear/invalid station name:

$ mvg Tor
   /!\ Station unknown!  Did you mean...? /!\   
 - Am Münchner Tor
 - Sendlinger Tor


Returns JSON

$ mvg_json Hauptbahnhof
$ mvg_json Marienplatz
$ mvg_json Moosach Bf.

User Preferences

You can specify a default station or a default transports list (e.g. only specific transport systems) in a JSON file. This only affects the CLI version! The first available file will be loaded:

  1. file specified in the environment variable: MVG_FILE
  2. an existing .mvg file in the current directory (PWD)
  3. an existing .mvg file in the home directory of the current user (HOME)

Example .mvg file:


This limits the transports to U-Bahn and uses "Hauptbahnhof" as default station:

$ mvg
=[                         /Users/rmoriz/.mvg ]=
Hauptbahnhof: U
======================================[ 13:34 ]=
U1  | Mangfallplatz                 |  0 Minuten
U2  | Feldmoching                   |  0 Minuten
U4  | Arabellapark                  |  3 Minuten
U4  | Theresienwiese                |  4 Minuten

You can overwrite the station as mentioned above but the transport limitation is currently global!

$ mvg Ostbahnhof
=[                         /Users/rmoriz/.mvg ]=
Ostbahnhof: U
======================================[ 13:37 ]=
U5  | Neuperlach Süd                |  2 Minuten
U5  | Laimer Platz                  |  8 Minuten
U5  | Neuperlach Süd                | 12 Minuten

The default transports list (= all available) is:


[ :u, :bus, :tram, :s ]


["u", "bus", "tram", "s"]


see "specs/"-directory


This project is not related, acknowledged, sponsored... by MVG or SWM. Use at your own risk.


see LICENSE file (MIT)



Copyright © 2013 Roland Moriz, Moriz GmbH

LinkedIn Twitter

Bitdeli Badge

Something went wrong with that request. Please try again.