diff --git a/src/plugins/debugger/gdb/remotegdbprocess.cpp b/src/plugins/debugger/gdb/remotegdbprocess.cpp
index 0b84a5b4a02497f6f311ad981b7e432652c9ecfa..4f5657f54f6ed8ad331cd280e82484121a71fbf0 100644
--- a/src/plugins/debugger/gdb/remotegdbprocess.cpp
+++ b/src/plugins/debugger/gdb/remotegdbprocess.cpp
@@ -99,7 +99,8 @@ void RemoteGdbProcess::handleFifoCreationFinished(int exitStatus)
     if (exitStatus != SshRemoteProcess::ExitedNormally) {
         emitErrorExit(tr("Could not create FIFO."));
     } else {
-        m_appOutputReader = m_conn->createRemoteProcess("cat " + AppOutputFile);
+        m_appOutputReader = m_conn->createRemoteProcess("cat " + AppOutputFile
+            + " && rm -f " + AppOutputFile);
         connect(m_appOutputReader.data(), SIGNAL(started()), this,
             SLOT(handleAppOutputReaderStarted()));
         connect(m_appOutputReader.data(), SIGNAL(closed(int)), this,
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp
index 67664f0cd0c1309424531dcc1c6c5c043ca41f62..f2cf09994f12d803a7ed8a8a5f3baeb3aadba7d5 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp
@@ -387,7 +387,7 @@ void MaemoDeployStep::handleSftpJobFinished(Core::SftpJobId,
         .arg(filePathNative));
     const QString remoteFilePath
         = uploadDir() + QLatin1Char('/') + QFileInfo(filePathNative).fileName();
-    runDpkg(remoteFilePath);
+    runDpkg(remoteFilePath, true);
 }
 
 void MaemoDeployStep::handleMounted()
@@ -400,7 +400,7 @@ void MaemoDeployStep::handleMounted()
     if (m_needsInstall) {
         const QString remoteFilePath = deployMountPoint() + QLatin1Char('/')
             + QFileInfo(packagingStep()->packageFilePath()).fileName();
-        runDpkg(remoteFilePath);
+        runDpkg(remoteFilePath, false);
     } else {
         copyNextFileToDevice();
     }
@@ -605,11 +605,14 @@ void MaemoDeployStep::unmountOldDirs()
     m_mounter->unmount();
 }
 
-void MaemoDeployStep::runDpkg(const QString &packageFilePath)
+void MaemoDeployStep::runDpkg(const QString &packageFilePath,
+    bool removeAfterInstall)
 {
     writeOutput(tr("Installing package to device..."));
-    const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + " dpkg -i "
+    QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + " dpkg -i "
         + packageFilePath.toUtf8();
+    if (removeAfterInstall)
+        cmd += " && rm " + packageFilePath.toUtf8() + " || :";
     m_deviceInstaller = m_connection->createRemoteProcess(cmd);
     connect(m_deviceInstaller.data(), SIGNAL(closed(int)), this,
         SLOT(handleInstallationFinished(int)));
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h
index c88ab5f7a471d94f70a3f7075619ecdc08bf69b3..7c1076c2e123cfd7b19f1ef8838168de4b6f71b4 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h
@@ -134,7 +134,7 @@ private:
     void unmountOldDirs();
     void setupMount();
     void prepareSftpConnection();
-    void runDpkg(const QString &packageFilePath);
+    void runDpkg(const QString &packageFilePath, bool removeAfterInstall);
 
     static const QLatin1String Id;
 
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp
index 84fdd1cb614607f53a254085405f8083c73bf8b0..8431fea3ca1ac521c19787f3ef9afeb9d860ae09 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp
@@ -113,7 +113,7 @@ void MaemoRemoteMounter::unmount()
 
     QString remoteCall;
     for (int i = 0; i < m_mountSpecs.count(); ++i) {
-        remoteCall += QString::fromLocal8Bit("%1 umount %2;")
+        remoteCall += QString::fromLocal8Bit("%1 umount %2 && %1 rmdir %2;")
             .arg(MaemoGlobal::remoteSudo(),
                 m_mountSpecs.at(i).mountSpec.remoteMountPoint);
     }